On Dec 11, [EMAIL PROTECTED] said:

>The program reads line by line(<FILE>), and processes the lines.
>At a certain line I need to read the next line,
>check what its contents are, and then readjust  
>the file pointer back to the first line. Since its not a fixed length, its
>difficult using seek().

When you say "first line", do you mean the very first line of the file, or
the line it was just at?

For the very first line, simply use:

  seek FILE, 0, 0;

If you want to go one line previous, use tell() beforehand:

  $pos = tell FILE;
  $line = <FILE>;
  seek FILE, $pos, 0;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to