in reply to Re: Re: Skip and Scan Lines
in thread Skip and Scan Lines
When the first loop finds the first line you wants to process, it exits with the line still being in $_. Then the condition of the second while loop reads the next line to $_ thus discarding the first one. You should write
towhile (<LOG>) { ... processing log line .... }
Because of the special way perl handles do {} while, the condition is evaluated only after the body has run first, so the body processed the line that's still in $_.do { ... processing log line .... } while <LOG>;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Skip and Scan Lines
by jc7 (Initiate) on Mar 22, 2004 at 19:08 UTC |