As Fletch says, it looks like you're simply missing the '}' where marked below:
#!/usr/bin/perl use strict; use warnings; my $ping = "/bin/ping"; while (<DATA>) { chomp; my $ping_out = `$ping $_ 2> /dev/null`; chomp ($ping_out); if ($ping_out !~ /bytes from/) { print "$_ isn't pinging\n"; } else { print "$_ is up\n"; } # <--- You're missing a '}' right here to end the while { } loop __DATA__ SERVER01 SERVER02
Was there some reason that "Missing right curly or square bracket" didn't lead you to that conclusion?
And do you understand how to put <code> and </code> tags around your post so that it's readable? If not, pay close attention when you hit "preview". If it doesn't look right, don't click the "create" button until it does! (You can continue clicking on "preview" until the post displays correctly).
In reply to Re^2: Ping sweep with reporting
by liverpole
in thread Ping sweep with reporting
by StarkRavingCalm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |