I have created a script that will ftp a file to a number of different servers. The problem I am having is the file is being transferred and the file size remains the same but the file looks empty. All the characters in the file are being replaced with NULL values.
sub ftp_file{ my ( $hosts ) = @_; my ($pass, $remotefile); my @hosts = (); my %host = (); my $currdir = cwd(); my $localfile = sprintf("%s/%s", $params->get("Path.From"), $params->get("File")); if ($params->exists("Path.To")){ $remotefile = sprintf("%s/%s", $params->get("Path.To"), $params->get("File")); }#end if statement else{ $remotefile = sprintf("%s/%s", $params->get("Path.From"), $params->get("File")); }#end else statement &ebenx::nm_UnHide($pass, $hosts->[2]); my $host = { 'host' => $hosts->[0], 'login' => $hosts->[1], 'pass' => $pass }; $app->log($INFO, "Copying [ $localfile ] to $$host{host}"); my $ftp = new Net::FTP($$host{host}, Timeout => 30) or $app->log($FATAL, "Unable to initialize ftp object: $!"); $ftp->login($$host{login}, $$host{pass} ) or $app->log($FATAL, "Unable to login to $$host{host}: $!"); $ftp->put($localfile, $remotefile) or $app->log($FATAL, "Unable to put $localfile to $$host{host} + as $remotefile: $!"); $ftp->quit(); }#end ftp_file

In reply to NET::FTP replaces characters in file with NULL by mnlight

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.