in reply to Re: Specifying a DNS resolver
in thread Specifying a DNS resolver

What you would need for that is a loop, which is the very thing in your code which has been commented out. Why?

Sample working solution (data modified to become an SSCCE):

use warnings; use strict; use Net::DNS; my @resolver = qw[192.168.50.50 8.8.8.8]; for my $dnsserver (@resolver) { print "Validating Entries against $dnsserver\n"; my $resolver = Net::DNS::Resolver->new( nameservers =>[$dnsserver], recurse => 1, debug => 1, ); print " ##### Resolver State ##### \n"; $resolver->print; print "\n\n ##### End Resolver State ##### \n"; my $query = $resolver->query('www.perlmonks.org', 'A'); if ($query) { foreach my $answer ($query->answer) { next unless $answer->type eq 'A'; print $answer->rdatastr, "\n"; } } else { print "query failed: ", $resolver->errorstring, "\n"; next; } }

🦛

Replies are listed 'Best First'.
Re^3: Specifying a DNS resolver
by Anonymous Monk on Apr 07, 2023 at 15:47 UTC

    I commented it out because I was not sure if that was accurate or if there was a function with Net::DNS that was available that I was not aware or able locate searching the web. If doing the loop, as you have indicated and I had in the code is the best/only solution, I am going with it. Thank you for your response and have a great day