Perl ping

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



                                    
原文地址:https://www.cnblogs.com/hzcya1995/p/13350103.html