Perl: Sending file from UNIX server to Windows server

I'm trying to write a Perl script where a file from a UNIX server box connects to a Windows server box and copies that file into the Window box.
The main problem I have right now is that whenever I try to connect to the Windows box, the connection is refused.

The error message that always pops up is:
cannot connect to host name: Net::FTP: connect: Connection refused at transfer.pl line 16.

My code is essentially this:

#!/user/bin/perl -w

use strict;
use Net::FTP;

my $directory = `pwd`;
chomp($directory);
$directory .= "/";

#print "Give name of file being transferred:\n";
#chomp($directory .= <>);

my $host = '<server name or ip address>';

my $ftp = Net::FTP->new($host, Debug => 0) or die "cannot connect to host name: $@";
$ftp->quit;

Any thoughts as to why this would happen (ex. firewall issues)?
For the host name, I use the domain name (both the short and full versions) and the actual IP address, but all of them have the same error message.
Many thanks!

First choose a protocol, ssh2 (scp2) is a great first choice, but you seem to be using ftp. There is the mount flavored family like NFS and SAMBA, file only tools like ftp, and file/command tools like rcp/rsh, scp/ssh/sftp, ssh2/scp2/sftp2. There are services, like http, you could create to facilitate this. There are often perl extensions to allow you to do these inside perl.

Get the protocol working from the command line before getting into code with it.

Some Suggestions.

  1. Turn the "Debug" Param on:
Debug => 1
  1. Set it to "2" if that shows more output ( it does with Net::SSH::Perl ) e.g.
Debug => 2
  1. Check if you can login to the win machine from the unix machine on the command line
  you@unixbox: ftp ftp.winbox.net 
  1. if not telnet to port 21 ( the FTP command channel )
  you@unixbox: telnet ftp.winbox.net 21 
  1. if not see if anything is getting through to the windows box.
 you@unixbox: /usr/bin/nmap -T5 ftp.winbox.net -p 0-1024 

( if you don't have nmap installed install it with apt-get install nmap or yum install nmap. )

Let us know what happened. Good luck.