#! /usr/bin/perl -w use strict; use Socket; while( <> ) { chomp; my $host; if( $host = gethostbyaddr( inet_aton($_), AF_INET )) { print "$_ resolves to $host\n"; } else { print "$_ has no DNS information\n"; } } #### #! /usr/bin/perl -w use strict; use Socket; while( <> ) { chomp; my $ip; if( $ip = gethostbyname( $_ )) { print "$_ resolves to " . inet_ntoa($ip) . "\n"; } else { print "$_ has no DNS information\n"; } }