use open ':std', ':locale'; # So stuff you print shows up right. $_ = "\\u6b63"; print "orig string length is ", length($_), "\n"; print "orig string is $_\n"; s/\\u(.{4})/chr(hex($1))/eg; print "decoded string length is ", length($_), "\n"; print "decoded string is $_\n";