I seem to recall having a similar issue in the past.
IIRC, it had to do with the fact that windows uses a udp ping instead of icmp.
Try changing this line:
my $p = Net::Ping->new("icmp");
also, if you have multiple interfaces, force it to bind to one: