Re: Script Required to Check a range of IP's



Prabu schreef:


open(FILE,"$file_name") || die "Not been Accessed" ;

open my $fh, '<', $file_name or die "open $file_name: $!" ;


if($p->ping($host, 2))
{
chomp($host);
print "$host is alive.\n";
}
else
{
chomp($host);
print "$host not reachable.\n";
}
sleep(1);

You are calling ping() with an un-comp-ed $host.

chompt $host ;
print $p->ping($host, 2)
? "$host is alive.\n"
: "$host not reachable.\n" ;
sleep(1) ;


Further reading: perldoc Net::Ping
(like about tcp/udp/icmp).

--
Affijn, Ruud

"Gewoon is een tijger."


.