Joseph Herlant
version 1.0.0, 2013-10-24 : Initial version

To get the hostname of an IP (or for a file containing a list of IP, each on one line).

perl -MSocket -ple '$_=gethostbyaddr inet_aton($_),AF_INET'

To get the ip (v4) of the hostname (or for a file containing a list of hostnames, each on a line).

perl -MSocket -nle 'printf"%d.%d.%d.%d\n",unpack"C4",$_ for splice @{[gethostbyname$_]},4'