post by yamamoto | 0 | 989 views

Perl メモ 配列要素のgrep

    my @found = grep ( /$patten/, @chapter);
    print $#found+1, "\n";
    
    foreach $found (@found) {
        print $found,"\n";
        if ($found=~/^(第)(.+?)(章)/){
        #if ($found=~/(.*第)(.+?)(章.*)/){
            my $ch = $2;
            print {ch}."\n";
            print $found,"\n";            
        }
        print $found,"\n";
     }

コメントを残す