in reply to multiple regex logical AND
As previously noted, /^JRECOV="yes"/ && /^TEOJ="-w"/ is no good.
The desired condition is "Were JRECOV and TEOJ seen in the file?" Notice the past tense. The "and" needs to be done at the end of the file.
while (<>) { if ($seen) { $seen = 1; print "$ARGV: "; } $JRECOV = 1 if /^JRECOV="yes"/; $TEOJ = 1 if /^TEOJ="-w"/; if (eof) { # Not eof()! print $JRECOV && $TEOJ ? "yes" : "no", "\n"; $seen = 0; $JRECOV = 0; $TEOJ = 0; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: multiple regex logical AND
by bigswifty00000 (Beadle) on Dec 13, 2006 at 17:03 UTC | |
by ikegami (Patriarch) on Dec 13, 2006 at 17:14 UTC |