You may want to try.
#!/usr/bin/perl -w use strict; use Net::Ping; $| = 1; my @hosts = <DATA>; my @proto = ("tcp", "udp", "icmp", "stream", "syn"); foreach my $pro ( @proto ) { print "\nProtocol $pro \n"; my $p = Net::Ping->new($pro); foreach my $host( @hosts ) { chomp($host); # Specify source interface of pings print "$host is "; print "NOT " unless $p->ping($host, 2); print "reachable.\n"; } $p->close(); } exit; __DATA__ 127.0.0.1 www.perlmonks.com
In reply to Re^3: Solution to broken Net::Ping
by Generoso
in thread Solution to broken Net::Ping
by solignis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |