in reply to Get server name from ip address

A note on using name to IP / IP to name translations using DNS:

All answers you get from these translations depend on how the specific DNS domains are set up. Without going into details, when doing a name to IP translation and then doing a IP to name translation (a so called 'reverse lookup') you might end up with a different name than you started with. For instance for 'www.perlmonks.org' your scipt will output:
209.197.123.153 66.39.54.27
When doing a reverse lookup on these addresses (I used the 'dig -x <addr>' to do this) you'll get:
perlmonks.pair.com
and
ads.perlmonks.org
This is because forward and reverse DNS don't have to be the same. And to complicate things even further DNS-records change in time. So an answer you got for a 'gethostbyname' query today can be different from an answer you got yesterday.