Created
February 3, 2009 02:44
-
-
Save iDiogenes/57264 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Net::DNS; | |
my $res = Net::DNS::Resolver->new; | |
my $query = $res->search("host.example.com"); | |
if ($query) { | |
foreach my $rr ($query->answer) { | |
next unless $rr->type eq "A"; | |
print $rr->address, "\n"; | |
} | |
} else { | |
warn "query failed: ", $res->errorstring, "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment