find_lamers.pl (2) 

foreach my $rr ($packet->answer) {
    if ($rr->{type} eq 'NS') {
        my $ns = lc($rr->rdatastr);
        $ns =~ s{ . \z }{}xms;
        $data->{$domain}{$level}{answer}{$ns}{name} = $ns;
    }
}
foreach my $rr ($packet->additional) {
    if ($rr->{type} eq 'A') {
        $data->{$domain}{$level}{answer}{lc($rr->name)}{ip4} = lc($rr->rdatastr);
        $ns_ip = lc($rr->rdatastr);
    }
    elsif ($rr->{type} eq 'AAAA') {
        $data->{$domain}{$level}{answer}{lc($rr->name)}{ip6} = lc($rr->rdatastr);
    }
}