my @octet = split /\./, $dec; my $hex = sprintf +(join ".", ("%02X") x @octet), @octet;