monger has asked for the wisdom of the Perl Monks concerning the following question:
Now, building the hash hasn't yet worked. I've tried several way to confirm the hash contents, but they are never there. So, how do I populate the hash with $_ being the key and $a the value? What I'll do next is call s///r against the original copy to search and replace the IPs with hostnames, thusly:while (<NS>) { $a = nslookup (host => "$_", type => "PTR"); %hosts($_, $a); }
I've never been able to confirm that this is the appropriate method for searching a file based on contents in a hash.while ( ($ip, $a) = each (%hosts)) { foreach $line (@final) { s/$hosts{$1}/$hosts{$2}/g; print FQDN $_; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Another NSlookup Question
by naChoZ (Curate) on Aug 15, 2003 at 19:29 UTC |