>>682
3項演算子であれば多少短くなるかな
foreach my $wd (@wd) {
$flg = $com =~ /^(?:$ascii|$hankana|$twobytes)*?\Q$wd\E/ ? $flg + 1 : 0;
last if 0 == $flg;
}