http://www.perlmonks.org?node_id=673970


in reply to Pulling IPv6 Address from Hostname

use Net::DNS; my $res = Net::DNS::Resolver->new; my $query = $res->query("example.com", "AAAA"); if ($query) { foreach $rr (grep { $_->type eq 'AAAA' } $query->answer) { print $rr->address, "\n"; } } else { warn "query failed: ", $res->errorstring, "\n"; }

The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon