Format: gethostbyaddr(ADDRESS, DOMAIN_NUMBER);

#!/bin/perl
$address=pack("C4", 127,0,0,1);
($name, $aliases,  $addrtype, $length, @addrs) = gethostbyaddr($address,2);
($a, $b, $c, $d) = unpack ( 'C4', $addrs[0]);
print "Hostname Is $name and the Internet address Is $a.$b.$c.$d.\n";