Perl ping

时间:2023-03-09 15:24:35
Perl ping
<pre name="code" class="html">use Net::Ping;
$p = Net::Ping->new("icmp");
while (1==1){
open (LIST,"<","list.txt") || die "$!\n";
while (<LIST>)
{chomp;
my $host=$_;
if ($p->ping($host))
{print "$host is alive\n";}
else
{print "$host is die\n"};
}
close LIST;
sleep(5);
} 192.168.11.1
192.168.10.1
192.168.5.1