print unpack "H*", pack("H*", map { "0" x (length($_) % 2) . $_ } "a12"); print unpack "H*", pack("H*", "0" x (length($_) % 2) . $_ ) for "a12";