- Perl初心者スレ(マジレス回答)
352 :349[sage]:2015/01/19(月) 22:36:30.03 ID:bxHKMq/8 - >>346
ヒント助かった。 use Encode qw/encode decode/; my $enc = 'UTF-8'; sub d($) { decode($enc, shift) } sub e($) { encode($enc, shift) } my $seach_word = "日本語"; my $found_res = 0; my $res = ""; while (<>) { if (/^\d/x) { if ( $found_res == 1 ) { print $res; $found_res = 0; } $res = ""; } else { my $seach_word_ = e$seach_word; if (/$seach_word_/x) { $found_res = 1; } } $res .= $_; }
|
|