Apologies for the layout and busted thread - I'm on digest mode
From: "JupiterHost.Net" <[EMAIL PROTECTED]>
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 :)

yep - strictly hardcoded for this useage.

perl -mstrict -we 'my @m = (q(^\d+$), q(^\w+$)); for my $item (qw(123 abc 1-2we)){ next if grep { $item =~ /$_/ } @m; print "$item\n"; }'
HTH :)
Lee.M - JupiterHost.Net

Thanks Lee - that does look like what I was thinking of.
I'm now using
while (<RAWREPORT>) {
my @linesToDiscard = ( q(\f), q(^DATE : ), q(^\s{15,}PART ), q(^COUNTER QTY), q(^\s+$) ) ;
my $lineItem = $_ ;
next if grep { $lineItem =~ /$_/ } @linesToDiscard ;
etc.....


From: "John W. Krahn" <[EMAIL PROTECTED]>
What you probably want is:
while ( <RAWREPORT> ) {
next if /\f|^DATE : |^\s{15,}PART |^COUNTER QTY|^\s+$/ ;
print ; # debugging purposes - other stuff here
}
Although you should read this first:
perldoc -q "How do I efficiently match many regular expressions at once"
John

Hi John - I did think of using the | in the regex, but didn't that wasn't what I was after.
Long term I _may_ use this for different reports, or the report _may_ change, and I wanted
and easy spot to make changes.
I read that FAQ, and I don't understand it...:-) ....yet. Thanks, I see how it applies,
but I think I'll skip using it until I get how that suggestion works. I've made a note
to revisit later.


So, now I'm off to figure out this scoping problem I have....
But I'm learning !

Brian

--
"I don't understand," said the scientist, "why you lemmings all rush down
to the sea and drown yourselves."
"How curious," said the lemming. "The one thing I don't understand is why
you human beings don't."
-- James Thurber



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to