in reply to Re^3: Ping sweep with reporting
in thread Ping sweep with reporting
Ok, here's what I have:
<code>
#!/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";
}
}
__DATA__
myserver02
<code/>
And here's the output:
root@stewie ~# perl pingsweep_pm.pl
isn't pinging
Thoughts?
In Section
Seekers of Perl Wisdom