use strict; use warnings; use Net::Ping; my $p = Net::Ping->new('icmp', 1); my $result = $p->ping('192.168.2.1'); print "Result is $result\n";