in reply to Quick version of "first record" to "last record" ?

How about

  1. Open the file.
  2. Read until the first valid record is reached. That's your First Record.
  3. Reopen the file with File::ReadBackwards.
  4. Read until the first valid record is reached. That's your Last Record.

I've never used the module, but someone who did once praised it here on Perl Monks. Also, the docs say it's "memory efficient", so it doesn't read the whole file into memory.

  • Comment on Re: Quick version of "first record" to "last record" ?

Replies are listed 'Best First'.
Re^2: Quick version of "first record" to "last record" ?
by perlcapt (Pilgrim) on Oct 15, 2004 at 21:37 UTC
    Exactly what I'm looking for. CPAN has grow so big, it can take hours using the search engine to find specifically what your looking.. in cases like this, more time than to write a hack to solve the problem. We will always need human intelligence, experience, and memory -- hence Perl Monks.