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

I've been using Net::DNS to resolve hostnames 2 addresses, which works fine, now I want to do it the other way around, but I cannot find any info on how to get this working exactly:

see example from manual

If I feed this with a dotted ipnumber string, it returns nothing, same as for "PTR" requests. I'm puzzled by the ->address member, because it doesn't return anything when fed with a ip-number. There is no mention of other members that yield the hostname.

thoughts? anyone?

sofar

Replies are listed 'Best First'.
Re: Net::DNS address2hostname ?
by chromatic (Archbishop) on Jul 18, 2001 at 23:25 UTC
    use Socket; my $address = '127.0.0.1'; my $hostname = gethostbyaddr(inet_aton($address), AF_INET) or die "Couldn't resolve ($address): $!";