For a large domain data set, this will do it quickly, without the real need to analyze the results; IP will always be in $results{$domain}[0][4] . This is not a single request, but they will be executed at the same time (maximum 10 requests in process at any time by IIRC), so this will be done quickly. Just make sure that the DNS server operator does not have a problem with so many queries in a short period of time.
use AnyEvent::DNS; use Data::Dumper; my @domains = qw/google.com/; my $resolver = AnyEvent::DNS->new( server => '8.8.4.4' ); my %results;
Outputs:
$VAR1 = { 'google.com' => [ [ 'google.com', 'a', 'in', 300, '74.125.225.52' ], [ 'google.com', 'a', 'in', 300, '74.125.225.50' ], [ 'google.com', 'a', 'in', 300, '74.125.225.49' ], [ 'google.com', 'a', 'in', 300, '74.125.225.48' ], [ 'google.com', 'a', 'in', 300, '74.125.225.51' ] ] };
source share