use strict; use Socket; my $addr = shift || '172.17.0.1'; my ($name,$aliases) = gethostbyaddr(inet_aton($addr), AF_INET); print "address $addr has the following names:\n"; print "\t$_\n" for ($name, split / /, $aliases); #### address 172.17.0.1 has the following names: host1.example.com host2.example.com host3.example.com host4.example.com host5.example.com