I'm writing a script that takes a list of ipaddresses as input and converts them to hostnames...... .
The problem here is some of the ip addresses do not resolve to their hostnames and for those ip addresses perl get hung and never goes to resolve the next given ipaddress....
Any suggestion is appreciated !
The problem here is some of the ip addresses do not resolve to their hostnames and for those ip addresses perl get hung and never goes to resolve the next given ipaddress....
Any suggestion is appreciated !
Code:
open (F,$filename) or die 'Cannot open file';
while(<F>){
push @sip,$_;
}
foreach $sip(@sip){
chomp($sip);
$packaddr = pack ("C4", split (/\./, $sip) );
$ns = gethostbyaddr($packaddr, 2);
print "$sip ------- $ns\n";
close F;
Comment