use Net::Ping;
my @array=( "www.zjtlcb.com",
"www.jhccb.com.cn",
"www.czcb.com.cn",
"www.wzcb.com.cn",
"ebank.czcb.com.cn",
"www.hzbank.com.cn"
);
while (1==1){
foreach $host (@array){
$p = Net::Ping->new("icmp");
open (A, ">>ping.log");
(print "$host is active.
",
print A ("$host is active.
")
) if $p->ping($host,8);
open (B ,">>ping.log");
( print "$host is lost.
aaaaaaa",
print B ("$host is lost.
")
) unless $p->ping($host,8);
$p->close();
# sleep(2)
}}