Hello Perl Monks, The code I have below, works fine for all intended purposes of what specifically needs to be accomplish. However, there is one item that i also would like to incorporate but not sure how or if it is possible. Is, there a way below, to incorporate the ability to specify one or more DNS resolvers to resolve the lookups against?

use Net::hostent; use Socket; use Data::Dumper::Simple; $IP='192.168.50.70'; $resolver='192.168.10.99'; Host_IP (); print "\n\n\n\n"; Host_Name ('garytest'); sub Host_IP () { $address=inet_aton($IP); if($hent = gethostbyaddr($address)) { $name = $hent->name; $aliases = $hent->aliases; $RESULT="NSLOOKUP by IP: $IP => $name"; print $RESULT; if (scalar(@{$aliases} > 1)) { $RESULT=" Multiple hostnames are being returned. Correc +t DNS\n"; $RESULT = $RESULT . " \taddress $IP has the following na +mes:\n"; $RESULT = $RESULT . "\t$_\n" for ($name, @{$aliases}); print $RESULT; } }else { $RESULT= "NSLOOKUP by IP: $IP => #### UNRESOLVABLE ####"; print $RESULT; } } sub Host_Name () { $name=shift; if ($hent = gethostbyname($name)) { $name2 = $hent->name; # in case different $addr_ref = $hent->addr_list; @addresses = map { inet_ntoa($_) } @$addr_ref; push(@all_addresses,@addresses); $RESULT= "NSLOOKUP by Name: $name => $name2 => " . join(', ', +sort(@addresses)) ; print $RESULT; if (scalar(@addresses) > 1) { $RESULT="\n Multiple IP Address being returned. Correct + DNS"; print $RESULT; } } else{ $RESULT= "NSLOOKUP by Name: $name => #### UNRESOLVABLE ####"; print $RESULT; } }

In reply to Specifying a DNS resolver by g_speran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.