in reply to Re: Ping sweep with reporting
in thread Ping sweep with reporting
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).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Ping sweep with reporting
by StarkRavingCalm (Sexton) on May 17, 2007 at 14:31 UTC | |
by StarkRavingCalm (Sexton) on May 17, 2007 at 20:19 UTC | |
by liverpole (Monsignor) on May 17, 2007 at 22:13 UTC | |
by StarkRavingCalm (Sexton) on May 17, 2007 at 20:14 UTC |