Joe, if you still care, here is my final code. Will you please eval it and them comment again?
thanks, my $outfile0 = qq(/home/root/dns_servers.plout); open (F, "+>$outfile0") || die "could not open file: $outfile0 $!"; my @a=(); my $e=0; my $res = Net::DNS::Resolver->new; my $query = $res->query(".ohnet", "NS"); if ( $query != 0 or $query != undef or $query != ' ' ) { foreach ($query->answer) { if ( $_->type eq 'NS' ) { #next unless $_->type eq "A"; foreach ($_->nsdname) { push (@a,$_) if $_ =~ "svr"; $e++; } # END 2nd FOR LOOP } else { print F "DNS query failed: ", $res->errorstring, "\n"; } # END 2nd IF } # END 1st FOR LOOP } # END 1st IF @a = sort { $a cmp $b } @a; print F $a[0],"\n"; print F $a[1],"\n"; close (F); Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>