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
while (<LOG>) {
... processing log line ....
}
to do {
... processing log line ....
} while <LOG>;
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 $_.
|