in reply to Re: seek question
in thread seek question

The seek() function deals with bytes. It knows nothing at all about "lines" or line numbers.

Of course in this case, you could close the file and then re-open it to reset the $. line counter. I've never had to do that, but it would work.

Replies are listed 'Best First'.
Re^3: seek question
by stevieb (Canon) on Feb 09, 2017 at 21:42 UTC

    I understand that, but OP was looping over the file handle which does use $.. I just meant that seek() does not reset this when going back to first row, first column, so that has to be done manually.

    I concur that closing/re-opening the handle would have the same effect as $. = 0;.