in reply to Ping error on WinXP

The Net::Ping croaking in the following line

$self->{"port_num"} = (getservbyname('echo', 'tcp'))[2] ||

So I'm affraid that echo service is not defined in the services file ( c:\windows\system32\drivers\etc\services ), you might want to add echo service there which BTW uses port 7

I don't know what are you trying to do, but if I'm guessing correctly you only want to get the status of a host using regular ICMP pings ( like command line's ping ), in order to use icmp you have to specify that in the Net::Ping's constructor

use strict; use warnings; use Net::Ping; my $ping = Net::Ping->new('icmp'); if ( $ping->ping('127.0.0.1') ) { print "alive\n"; } else { print "dead\n"; }