Use a while loop instead, and then just do another $line = <TF>; within the loop body. This will both read the next line and advance the file pointer.
while ($line = <TF>) { ... $line = <TF>; }
The problem with the for loop is that all the lines already have been read (because of <TF> being in list context) before the loop starts iterating.
In reply to Re: advancing in file read
by almut
in thread advancing in file read
by cammac
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |