in reply to decimal -> hex


Here is one way:
$ip_hex = join '.', map {sprintf "%02x", $_} split /\./, $ip_dec; $ip_dec = join '.', map {hex} split /\./, $ip_hex;

--
John.