Perl Script to Translating IP Address to Host Names

IP Address to Host Name Translation

The following Perl Script is used to convert the IP addresses into Host Names. gethostbyaddr() function receives an IP Address and convert it into generic host address that have been registered for

Translate IP Address to Host Name


use Socket;
my $ADDR_PAT = /^d+.d+.d+.d+$/;

while (<>) {
die "$_: Not a valid address" unless /$ADDR_PAT/o;
my $name = gethostbyaddr(inet_aton($_),AF_INET);
$name ||= '?';
print "$_ => $name\n";

Related Topic Get Host Name By IP Address
How to Translate the Host IP Address to Host Names
PHP Programming Best Practices
Perl Script to Get DNS Address of a Host
How to Configure Apache web Server Document Root Directive 2011   Privacy Policy  Terms of Service  Feedback