PrintUnicodeString($str); PrintUnicodeString{ join("", map { printf("\\x{%04X}", $_) # \x{...} } unpack("U*", $_[0])); # unpack Unicode characters }