for my $key (keys %AoH) { for my $domain qw(ns7.xxx.com wrnadc02.xx.xxxxxx.com) { nsqry($domain, $_ ) for @{$AoH{$key}} ; } }