MermaidGaby
Programmer
Everytime I try to ping live hosts with this code, I get the incorrect output ("not alive"
. Why is it that it is not detecting live hosts. I know I may be making a dumb mistake, but, be nice, I am new to perl.
<code>
#use Net:
ing perl library
use Net:
ing;
#Create a new ping object
#$p=Net:
ing->new();
$host="localhost";
$p = Net:
ing->new();
if ($p->ping($host))
{print "$host is alive.\n";}
else
{print "not alive.\n";}
$p->close();
</code<
<code>
#use Net:
use Net:
#Create a new ping object
#$p=Net:
$host="localhost";
$p = Net:
if ($p->ping($host))
{print "$host is alive.\n";}
else
{print "not alive.\n";}
$p->close();
</code<