Skip to content

Instantly share code, notes, and snippets.

@iDiogenes
Created February 3, 2009 02:44
Show Gist options
  • Save iDiogenes/57264 to your computer and use it in GitHub Desktop.
Save iDiogenes/57264 to your computer and use it in GitHub Desktop.
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