foreach $key(%Servers){
should be:
foreach $key (keys %Servers){
and actually I'd scrap the first declaration of $key and make that:
foreach my $key (keys %Servers){
You'd also do well to check the status of your Net::FTP
methods. new() returns undef and an error message in $@ on failure, and the rest will return undef but the error message will be returned from
$FTP->message (and don't put it in quotes since its a method not a variable).
And why are you chomping $IP?? It doesn't come from any file or user input...
Update: Though a good catch, this line:
$IP="$Server{$key}";
is almost certainly just a typo here since use
strict should be
complaining about it (generating a "Global symbol requires explicit package name..." error) before the runtime error that
RedDog
is currently getting (at least I get a compile time error
with build 628, if you don't get one with that code, maybe you
should upgrade). And I agree with the opinions that
if you don't need a hash, don't put the IP's in a hash.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.