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

Greetings, Perl Masters! Would any know of a Perl script to resolve a file of IP addresses into actual domain names? Thank you!

Replies are listed 'Best First'.
Re: resolve IP address into domain name
by jdporter (Paladin) on May 12, 2005 at 02:52 UTC
    First you convert the string rep of the IP address to an internal (long word) form, then look up the domain name using standard internet library functions:
    use Socket; # for AF_INET for my $ip_s ( @ip_strings ) { my $hostname = gethostbyaddr( inet_aton($ip_s), AF_INET ); }
Re: resolve IP address into domain name
by tlm (Prior) on May 12, 2005 at 02:48 UTC

    No, but if I had to do this, I'd start by looking at Net::DNS, and rolling my own.

    Here's a link to a related FAQ that you may find useful.

    the lowliest monk

Re: resolve IP address into domain name
by DrHyde (Prior) on May 12, 2005 at 09:09 UTC
    Why bother using perl?
    for ip in `cat addresses`; do host $ip; done