in reply to Net::Ftp Issue

I humbly suggest you modify your code to:
my $path = "Report_".$date.".csv"; net::ftp $ftp->get($path) or die "Cannot get '$path': $!\n";
That would answer your immediate question. You might want to do a pwd (or a cd) first; you're probably not in the directory you think you are.

Replies are listed 'Best First'.
Re^2: Net::Ftp Issue
by joepepsi18 (Novice) on Feb 04, 2008 at 20:55 UTC
    thanks apl! But no draw. The output gives me RETR and then the filename, which is correct, But still gives me the error "Bad file descriptor" I even copied and pasted that output and manually retreived the file and it was fine! I even made sure the path was correct ($ftp->pwd()). I suspect that the module may be inputting something else on the cmd line but how can I display that? Perhaps $ftp->message displays this (but not sure how to display it if it does) Can you provide some insight. Regards - perl newbie! :)
      Have you tried repeating the sequence of ftp commands interactively? (You can always ls to confirm the existence of the file.)

      Perhaps you could do a ftp->dir();, to see if the file shows up in the directory listing?

      For that matter, you could manually do a ls -b on the directory in question. Perhaps there's a non-printable character in the name of the file you're interested in.

        Thanks apl, but how do I print out the results of ftp->ls?

        I tried:
        my $result = $ftp->ls;
        print $result;

        But it does not return a value.
        Hello apl, I believe my last post didn't go through. My apologies.
        But can you let me know how I can print out the results of $ftp->ls or $ftp->dir?
        I tried to apply the results into a scalar, but it didn't print out anything
        my $result = $ftp->ls;
        print $result;
        Thanks!