I tried to ftp a file to a server using perl. I am able to connect to the server, but file is not transfered. [size of the file is zero bytes]. If i copy and paste it manually [ ftp command prompt] it is going. but not through perl].

The code i used is below,

use Net::FTP::File;
use Net::FTP;

my $ftp = Net::FTP->new("ip", Debug => 0)
or die "Cannot connect to some.host.name: [email protected]";

or die "Cannot login ", $ftp->message;
print "\n Connected to FTP \n".
$success = $ftp-> put("sample.jpg") or print "\n".$ftp->message;
print $success;
my $file_ = $ftp-> size("sample.jpg");
print "remote file size:$file_\n";

i am getting error message as "Failed to establish connection". I do know where the problem is.Please help me to trace out the problem.

P.Gerald Manickam