A line by line critique:
use Net::FTP; # You should 'use strict' if the final script is # going to be any longer than 5 or 10 lines, # which would make the next line 'my $ftp = ...'. # Also, according to the Net::FTP docs, connect # errors are reported in $@, not $! $ftp = Net::FTP->new("$host", debug => 1) or die "Host: $!"; # Error messages after new are reported in the # message() method ($ftp->message, and don't put it inside # quotes since methods won't get interpolated inside # quotes). This method is documented in Net::Cmd, which # Net::FTP inherits from. # Are $user and $pass set to anything? $ftp->login($user,$pass) or die "Login: $!"; # Same comment as above. $ftp->cwd() or die "Dir: $!"; # Are $file and $dir set to anything? # Does $dir exist on the local system? # Does $file exist in the current directory # on the remote system? # Is there a permission problem? # And you don't need to backwhack the "/" $ftp->get("$file","$dir\/$file") or die "File: $!"; $ftp->quit;
Also, in general, you don't need to put quotes around just a single variable, e.g. "$file", though some people consider it a matter of preference.
And again, Use strict and warnings :-)

In reply to Re: Re: NET::FTP error question by runrig
in thread NET::FTP error question by WintersMystic

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.