in reply to Problem with SEEK to go back/forward a few lines.

Perl is probably losing track of the current line number when you seek, but since you know the correct current line number, you can tell Perl by just writing it to $. when you're done seeking around.

Replies are listed 'Best First'.
Re: Re: Problem with SEEK to go back/forward a few lines.
by parv (Parson) on Oct 20, 2003 at 04:16 UTC

    >From perlvar...

      HANDLE->input_line_number(EXPR)
      $INPUT_LINE_NUMBER
      $NR
      $.      Current line number for the last filehandle accessed.
              ...
              You can adjust the counter by assigning to $., but this will
              not actually move the seek pointer.  Localizing $. will not
              localize the filehandle's line count.  Instead, it will local-
              ize perl's notion of which filehandle $. is currently aliased
              to.
    

    ...something to keep in mind.

    - parv