All the messy stuff I do in code to resolve those names to addresses is obscured in a module. I thought of putting all my code in a module, but wanted to see what you all use
TBH, with Net::DNS it is relatively simple so I've never bothered to code up a wrapper:
#!/usr/bin/env perl
use strict;
use warnings;
use Net::DNS;
my $res = Net::DNS::Resolver->new ();
print "Any: " . $res->query('www.google.com')->pop('answer')->rdstrin
+g . "\n";
print "IPv4: " . $res->query('www.google.com', 'A')->pop('answer')->rd
+string . "\n";
print "IPv6: " . $res->query('www.google.com', 'AAAA')->pop('answer')-
+>rdstring . "\n";
The advantage is that if you are interested in any other aspects of the responses or the resolver those are easily obtainable/settable.