Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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

Replies are listed 'Best First'.
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?
[shmem]: has there been any single day where nothing went wrong? not in my memory
[shmem]: discovered a fuel tank leakage at my second hand motorbike. Some bloke drove a screw too long through the fairing
[shmem]: hard to fix, and plans wrecked. And more... won't tell.
[shmem]: the leakage has been "fixed" with a piece of bycicle tube. Bleargh.
[karlgoethebier]: shmem: yes. my first ride tomorrow is questionable because of lumbago. shit
[shmem]: But! the bloke wasn't me, at least.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2017-06-25 19:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (570 votes). Check out past polls.