use utf8; use open ':std' => ':utf8'; utf8::encode($string);