#Example 2: it is not bytes, it is array of code point. #Code: @bytes=unpack("C*", $unicode_string); use strict; use warnings; use Encode qw(encode); use 5.012; my($code_point,$unicode_string,@bytes); $code_point=0x41;#A $unicode_string=pack('U*', $code_point); @bytes=unpack("C*", $unicode_string); print join('|', @bytes), "\n"; $code_point=0x3042;#HIRAGANA LETTER A $unicode_string=pack('U*', $code_point); @bytes=unpack("C*", $unicode_string); print join('|', @bytes), "\n"; #==>these are not bytes ,but array of codepoints $code_point=0x3042;#HIRAGANA LETTER A $unicode_string=pack('U*', $code_point); @bytes=map{ sprintf("%X",$_) } unpack("C*", Encode::encode('utf8',$unicode_string)); print join('|', @bytes), "\n";