RedDog has asked for the wisdom of the Perl Monks concerning the following question:
I am getting the following errors when I run this:#!perl -w use strict; use Net::FTP; my $Local="C:\\Winnt\\Profiles\\jlewis\\desktop"; my $File="cron.file"; my $key; my $IP; my $user="username"; # NOT the real username my $pass="password"; # And DEFINITELY NOT # the real password my %Servers=("1"=>'128.37.37.201', "2"=>'128.38.38.201', "3"=>'128.39.39.201'); chdir($Local); foreach $key(%Servers){ $IP="$Server{$key}"; chomp($IP); my $FTP=Net::FTP->new("$IP"); $FTP->login("$user","$pass"); $FTP->ascii(); $FTP->put($File); $FTP->quit; }
I know that this means the error that is causing it all is when I declare the variable $IP to be equal to the value of whatever hash key its currently looping through, but for the life of me, I can't figure out why its uninitialized.Use of uninitialized value in string at line 20,cronftp.pl Can't call method login on an undefined value at line 23,cronftp.pl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::FTP troubles
by runrig (Abbot) on Nov 09, 2001 at 02:13 UTC | |
by dmmiller2k (Chaplain) on Nov 09, 2001 at 19:21 UTC | |
by Fastolfe (Vicar) on Nov 12, 2001 at 21:04 UTC | |
|
Re: Net::FTP troubles
by Fastolfe (Vicar) on Nov 09, 2001 at 03:31 UTC | |
|
Re: Net::FTP troubles
by davis (Vicar) on Nov 09, 2001 at 15:13 UTC | |
|
Re: Net::FTP troubles
by blahblahblah (Priest) on Nov 09, 2001 at 11:46 UTC | |
|
Re: Net::FTP troubles
by alien_life_form (Pilgrim) on Nov 09, 2001 at 20:40 UTC | |
|
Re: Net::FTP troubles
by RedDog (Pilgrim) on Nov 10, 2001 at 00:47 UTC | |
|
Re: Net::FTP troubles
by Anonymous Monk on Nov 10, 2001 at 16:40 UTC | |
|
Re: Net::FTP troubles
by Anonymous Monk on Nov 12, 2001 at 22:56 UTC |