svankalken has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use Net::DNS::Resolver; use Thread::Pool; sub dnslookup { my $res=Net::DNS::Resolver->new; my $search = $res->search($input); foreach $rr ($search->answer) { my $type=$rr->type; if ($type eq "A") { $host=$rr->address; } if ($type eq "PTR") { $host=$rr->ptrdname; } if ($type eq "CNAME") { $host=$rr->cname; } } print "$host\t$input\n"; } open (FILE, "./foo") || die "Could not open file\n"; @ip=<FILE>; close (FILE); foreach (@ip) { $input=$_; print $input; &dnslookup; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::DNS looping help
by davido (Cardinal) on Jan 13, 2005 at 05:40 UTC | |
by svankalken (Novice) on Jan 13, 2005 at 06:17 UTC |