PING www.google.com (173.194.34.144) 56(84) bytes of data. 64 bytes from lhr14s21-in-f16.1e100.net (173.194.34.144): icmp_seq=1 ttl=57 time=159 ms 64 bytes from lhr14s21-in-f16.1e100.net (173.194.34.144): icmp_seq=2 ttl=57 time=190 ms 64 bytes from lhr14s21-in-f16.1e100.net (173.194.34.144): icmp_seq=3 ttl=57 time=72.6 ms 64 bytes from lhr14s21-in-f16.1e100.net (173.194.34.144): icmp_seq=4 ttl=57 time=199 ms 64 bytes from lhr14s21-in-f16.1e100.net (173.194.34.144): icmp_seq=5 ttl=57 time=69.4 ms #### my $p = Net::Ping->new("tcp", 2); # With or without this next line. $p->port_number(getservbyname("http", "tcp")); if ($p->ping("www.google.com")) { print "Host is reachable\n"; return 1; } else { print "Host is not reachable\n"; return 0; }