use Encode; my $str = decode('euc-jp',"あいうえお"); my $from = decode('euc-jp',"[あう]"); my $to = decode('euc-jp',"ひゃはー"); $str =~ s/$from/$to/g; print encode('euc-jp',$str)."\n";