Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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 =>

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
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?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2015-12-01 14:11 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (12 votes), past polls