SPUG: Parsing Huge Files

DeRykus, Charles E charles.e.derykus at boeing.com
Wed Nov 28 10:17:26 PST 2007


> Is there a faster execution hook, where I can get last 1000  lines of 
> huge file, without skipping to the end of file.

>> I would recommend File::ReadBackwards !   (it is like the "tac"
>> in that it will read the file in reverse line order) - so you need to
take that >> into account - used it to read in the last 1000 lines then
perhaps you will 
>> reverse() the array you fetch.

>> If you don't want to install it from CPAN you could open a pipe from
>> or just "tail -1000".

I'd second File::Backwards.  Tie::File which became part of the 
Perl distro (recent versions) would undoubtedly be slower but 
the interface might be a tad easier.

Charles DeRykus

More information about the spug-list mailing list