phathead22 has asked for the wisdom of the Perl Monks concerning the following question:

I have a simple problem that looks difficult. Let's see what you think:
When I run this section of a program as name "wftp3.pl", it works.
When I rename it to "wftp4.pl", it doesn't. Have I stumbled across a reserved
word in PERL?
use Net::FTP; my $servert = "xxxx"; my $logint = "xxxx"; my $passt = 'xxxx'; my $file = "wftp1.txt"; my $targetdir = "/xxx/xxxx/xxxx/xxx"; $ftp = Net::FTP->new("$servert", Debug => 0); $ftp->login("$logint",'$passt'); $ftp->cwd("$targetdir"); $ftp->put("$file"); $ftp->quit;

Thanks
PH

Replies are listed 'Best First'.
Re: Naming problem?
by kschwab (Vicar) on Feb 02, 2001 at 07:02 UTC
    Aside from the naming problem:

    $ftp->login("$logint",'$passt');

    $passt is in single quotes. The variable won't interpolate, and you'll literally be sending the string '$passt' as your password.

    A little error checking would help you out also. Pepper in a few "or die"'s :)

Re: Naming problem?
by arturo (Vicar) on Feb 02, 2001 at 05:02 UTC

    Stab in the dark: when you copy or move the file to the new file name, the execute bit on the new file is not set.

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Re: Naming problem?
by Fastolfe (Vicar) on Feb 02, 2001 at 04:51 UTC
    What do you mean by "doesn't work"?

    I cannot think of any reason this would give you a problem. My instincts say something else is going on.

    1. How are you renaming the files?
    2. How are you executing the scripts?
    3. What is the exact output you are getting?
    4. What version of Perl are you using?
Re: Naming problem?
by chipmunk (Parson) on Feb 02, 2001 at 04:50 UTC
    The name of the script makes no difference to Perl. Something else is going on.

    What do you mean by "it doesn't work"? How are you running the program? When you rename it to wftp4.pl, does it have the proper permissions? Are you also moving the file to a different directory when you rename it?