What is the purpose of
$key and the key to your hashes? Remember that pulling out the keys or hashes as they are won't result in sorted output, so you're going to be connecting to each FTP server in a pseudo-random order. It might be more efficient to just stick these IP's into an array and iterate through the array.
use strict;
use Net::FTP;
my $Local = 'c:\winnt\profiles\jlewis\desktop';
my $File = "cron.file";
my ($user, $pass) = ("username", "password");
my @servers = qw/ 128.37.37.201 128.38.38.201 128.39.39.201 /;
chdir($Local) or die "$Local: $!";
foreach (@servers) {
my $FTP = new Net::FTP ($_) or die "Can't connect to $_";
$FTP->login($user, $pass) or die "Can't login as $user"
$FTP->ascii;
$FTP->put($File) or die "Can't put $File"
$FTP->quit;
}
As another poster mentioned, you were iterating through
%Servers as a whole, which means you were trying to make connections to "1", "128.37.37.201", "2", etc. Since the first one wasn't a valid IP/hostname, the creation of your
$FTP object failed (which you weren't checking for), which means your call to
$FTP->login() couldn't be done since
$FTP wasn't defined. Hence all of those messages.
The warning about the uninitialized value came about because you were doing this: $IP="$Server{$key}" Since $key at one point was "128.37.37.201", you were trying stuff the value of that key in the hash into $IP. Since there was no key by that name (it was a value, remember), the result was undefined, hence that warning.
Hope this helps..