Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Net::Nslookup PTR lookup help (use Net::DNS)

by grinder (Bishop)
on Jan 28, 2009 at 13:52 UTC ( #739560=note: print w/ replies, xml ) Need Help??


in reply to Net::Nslookup PTR lookup help

Personally, I find Net::DNS much easier to use. Consider:

#! /usr/bin/perl -w use strict; use Net::DNS; my $r = Net::DNS::Resolver->new; for my $ip (@ARGV) { my $reverse = join( '.', reverse( split /\./, $ip )) . '.in-addr.a +rpa'; if (my $ap = $r->query( $reverse, 'PTR' )) { for my $pa ($ap->answer) { print "$ip => ", $pa->ptrdname, $/; } } else { print "$ip => NXDOMAIN\n"; } } __OUTPUT__ ./ptr 69.147.76.15 69.147.76.15 => f1.www.vip.re1.yahoo.com

Update: easier... hmmm... let me rephrase that: "gives me finer control over what I want to do". It's a really useful module to have in your toolkit if you ever have to grovel around with CNAME, MX, NS, SOA records and the like.

2nd update: new improved! with error checking!

• another intruder with the mooring in the heart of the Perl


Comment on Re: Net::Nslookup PTR lookup help (use Net::DNS)
Download Code
Re^2: Net::Nslookup PTR lookup help (use Net::DNS)
by blackstealth (Novice) on Jan 28, 2009 at 14:05 UTC
    Thank you very much i have tired that out and it works.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://739560]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2014-12-25 23:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (163 votes), past polls