Re: replacing multiple matches with an array
B McKee wrote: Hi All Hello, I have this bit of code in a program I'm working on. while () { next if /\f/ ; next if /^DATE : / ; next if /^\s{15,}PART / ; next if /^COUNTER QTY/ ; next if /^\s+$/ ; print ;
Re: replacing multiple matches with an array
Hello, I believe this will do what you want: next if grep { $rawreport_item =~ /$_/ } @possibleMatches; Just make sure the regexes in @possibleMatches are not user supplied or they may try sneaky bad things :) perl -mstrict -we 'my @m = (q(^\d+$), q(^\w+$)); for my $item (qw(123 abc 1-2we)){ n