in reply to Read File Backword

use Tie::File; my @ray=(); tie @ray,"Tie::File","myfile" or die $!; for(my $i=$#ray;$i>=0; $i--){ my $line=$ray[$i]; # do something with it... } untie @ray;
Caveat:thoroughly untest!

Replies are listed 'Best First'.
Re^2: Read File Backword
by gjeffrey (Acolyte) on Jul 27, 2004 at 19:44 UTC
    Thanks for the super quick response. Does this mean that all the file is read into memory before we can access
    $ray[$#ray]
    If this is the case for extremely large files 1GB, I may have a problem.

      No. I read the source code before. It only reads in lines when it is needed, besides it deletes lines from memory when the buffer overflows. Memory is not a concern for that module.