|
sub CanPing($ip)
{
use Net::Ping;
# Test icmp reachability ..
$p = Net::Ping->new("icmp");
if ($p->ping($ip))
{
$reach = "Reachable";
$IsReachable = 1;
$AllReachableCount ;
}
else
{
$reach = "Not Reachable";
$IsReachable = 0;
}
$p->close();
return $reach;
}
calling example :-
$reach = CanPing("192.168.0.1");
|
|