http://www.perlmonks.org?node_id=739549

blackstealth has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks i come to you in a bit of a pickle. I have been asked to parse some access logs and give feedback on who is using a utility ( the logs are very apache like) i have broken it down to where i can get day and ip and all that but they didn't like having the "ip address" cause they don't know what that ip is so i am using Net::Nslookup. I can get type => 'A' records and have turned on all the debugging and the dns is returning but i am not getting a value back i have even thought of the fact that it may be an arrary and haven't found anything there either. I have even created some test code and it does not work. I will use the test code to post here as it is much smaller and has the same issue:
#!/usr/bin/perl use strict; use Net::Nslookup; my $ip = nslookup( domain => 'www.yahoo.com', type => 'A' ); my $fqdn = nslookup ( domain => $ip, type => 'PTR' ); print "$ip -> $fqdn \n";
output:
69.147.76.15 ->  

Debug Output:
Performing 'A' lookup on `www.yahoo.com' at ./test.pl line 9
Performing 'PTR' lookup on `69.147.76.15' at ./test.pl line 11
;; search(69.147.76.15, PTR)
;; setting up an AF_INET() family type UDP socket
;; send_udp(24.28.201.85:53)
;; answer from 24.28.201.85:53 : 251 bytes
;; HEADER SECTION
;; id = 46054
;; qr = 1    opcode = QUERY    aa = 0    tc = 0    rd = 1
;; ra = 1    ad = 0    cd = 0    rcode  = NOERROR
;; qdcount = 1  ancount = 1  nscount = 5  arcount = 5

;; QUESTION SECTION (1 record)
;; 15.76.147.69.in-addr.arpa.   IN      PTR

;; ANSWER SECTION (1 record)
15.76.147.69.in-addr.arpa.      1166    IN      PTR     f1.www.vip.re1.yahoo.com.

;; AUTHORITY SECTION (5 records)
76.147.69.in-addr.arpa. 171250  IN      NS      ns2.yahoo.com.
76.147.69.in-addr.arpa. 171250  IN      NS      ns3.yahoo.com.
76.147.69.in-addr.arpa. 171250  IN      NS      ns4.yahoo.com.
76.147.69.in-addr.arpa. 171250  IN      NS      ns5.yahoo.com.
76.147.69.in-addr.arpa. 171250  IN      NS      ns1.yahoo.com.

;; ADDITIONAL SECTION (5 records)
ns5.yahoo.com.  51462   IN      A       119.160.247.124
ns4.yahoo.com.  22807   IN      A       68.142.196.63
ns3.yahoo.com.  22807   IN      A       217.12.4.104
ns2.yahoo.com.  22807   IN      A       68.142.255.16
ns1.yahoo.com.  77787   IN      A       68.180.131.16

69.147.76.15 ->