$ perl -wE' use Devel::Peek; use Encode; use utf8; my $str = "รค"; my $substr = substr($str, 0, 1); Dump $substr; $str = encode_utf8($str); $substr = substr($str, 0, 1); Dump $substr; ' SV = PV(0xa0ff780) at 0xa11cab0 REFCNT = 1 FLAGS = (PADMY,POK,pPOK,UTF8) PV = 0xa1209b8 "\303\244"\0 [UTF8 "\x{e4}"] CUR = 2 LEN = 4 SV = PV(0xa0ff780) at 0xa11cab0 REFCNT = 1 FLAGS = (PADMY,POK,pPOK) PV = 0xa1209b8 "\303"\0 CUR = 1 LEN = 4