my $shiftjis = q{ [\x30-\x39] | [\x41-\x59] | [\x61-\x7A] | [\x82-\x83][\x3F-\xFE] | [\x88][\x9E-\xFE] | [\x89-\xE9][\x3F-\xFE] | [\xEA][\x3F-\x9F] }; while(){ chomp(); s/[^${shiftjis}]/ogx; print $_."\n"; }