use Net::Ping; $pinghost = Net::Ping->new("tcp"); #Protocol for ping must be "icmp","udp","tcp","syn","stream",or "external" $domain = "sohu.com"; $ip = "184.22.37.92"; # if ($pinghost->ping('184.22.37.92')){ if ($pinghost->ping($domain)){ print "active.\n"; } else { print "inactive.\n"; } $pinghost->close();
perl ping-> 主机
http://hi.baidu.com/835094561/blog/item/b8b88d3f855f65e655e72371.html
perl ping检测脚本
http://baiqiuyi.com/perl/perl-ping-icmp-monitor.html