in reply to Skip and Scan Lines

while (<LOG>) consumes the line from the buffer. So, you find the starting line in the first while-loop, then continue from the next line in the second while loop.

Is there a reason you have the while-loops separated? Why not combine them and instead of breaking out when you find the first line, set a flag that says "I should be handling these lines" once you find the first good line. So, instead of "last when found", do "next unless found or this line is ok".

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re: Skip and Scan Lines
by Anonymous Monk on Mar 18, 2004 at 22:13 UTC
    Thanks for your suggestion! Then how to handle the command $ref->{start_chack_datetime} = $1? We only need to set it once when we find the first line. Also, how to set the flag? I am new to perl and would very appreciate if you can give me more details!