in reply to decimal -> hex

If the purpose of the conversion is to prepare an operand for a socket call, the dotted decimal ip notation must be converted to a packed 32 bit integer. For example, Perl's gethostbyaddress expects addresses in this format.
use Socket; $ipaddr = inet_aton(127.0.0.1); # In Perl 5.6 you can convert with the v-string notation: # $ipaddr = v127.0.0.1;
Off the back of the third camel, page 720.
Bob