On Fri, Aug 31, 2001 at 11:22:18AM -0800, Michael Fowler wrote:
> > $oneline = <LOGFILE>;
> > while ( $oneline =~ /(-{3,})/ )
> > {
> > # process one line
> > $oneline = <LOGFILE>;
> > }
I take back my statement that it is working. It's working as implemented,
but not as intended. The code you have (and the code I suggested, as well)
will continue processing only if the line matches the pattern. You
mentioned you want it to -stop- if it matches the pattern. In both code
snippets the sense of the test needs to be changed for this behaviour.
until ($oneline =~ /(-{3,})/) {
...
}
while (...) {
last if $oneline =~ /(-{3,})/;
...
}
Using the above, your code stops working correctly in some cases; undef
doesn't match /-{3,}/ so the loop will run forever, unless there is a line
that matches and the loop is exited early.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]