Hi All
        I have this bit of code in a program I'm working on.

     while (<RAWREPORT>) {
              next if /\f/ ;
              next if /^DATE : / ;
              next if /^\s{15,}PART / ;
              next if /^COUNTER QTY/ ;
              next if /^\s+$/  ;
              print ; # debugging purposes - other stuff here
    }

It works, but I'd rather put all my patterns in an array so it's neat and tidy.
Something like


my @possibleMatches = ("\f","^DATE :","^\s{15,}PART ","^COUNTER QTY","^\s+$") ;
while (<RAWREPORT>) {
next if /@possibleMatches/
print ; # debugging purposes - other stuff here
}


but that doesn't work as is. I could loop over the array I suppose and name each loop
something like [untested]


my @possibleMatches = ("\f","^DATE :","^\s{15,}PART ","^COUNTER QTY","^\s+$") ;
OUTER: while (<RAWREPORT>) {
INNER: foreach $my match (@possibleMatches) {
next OUTER if /$match/
print ; # debugging purposes - other stuff here
}
but that doesn't seem much better to me.
Is there a common way to do this?
Comments appreciated
Brian



-- 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