在工作中,我有类似的东西......
$ host www.something.com
www.something.com is an alias for some.other.address
some.other.address is an alias for one.more.address
one.more.address has address xxx.xxx.xxx.xxx
我想要一种方法,在Perl中放入www.something.com
并确定它是否是CNAME,A记录等。
答案 0 :(得分:8)
use Net::DNS qw();
my $query = Net::DNS::Resolver->new->search('conferences.yapceurope.org');
if ($query) {
foreach my $rr ($query->answer) {
next unless 'CNAME' eq $rr->type;
print $rr->cname;
}
} else {
warn sprintf "query failed: %s\n", $res->errorstring;
}