I am using perl -v 5.8.8. I am trying to create a Linux utility to ping the ipaddresses in a simple text file, and display the ip addresses of those hosts that are 'alive'. I would like to send only 1 packet to help speed up the process. My problem is that at this point I cannot even get the example to at http://www.perlmonks.com/index.pl?node=net%3A%3Aping to work.
I hope someone can give me some insight on how this code should work.
use Net::Ping;
$p = Net::Ping->new();
print "$host is alive.\n" if $p->ping($host);
$p->close();
$p = Net::Ping->new("icmp");
foreach $host (@host_array)