in reply to how to populate array with last 20 lines of file
I don't know if this is the "best" way, but one route would be to use Tie::File. It basically "represents a regular text file as a Perl array". And since it does not store the entire file into memory, you can use this for large files without major concern about memory usage - although the 8KB size you mentioned in another post isn't too big to store in memory.
If you use Tie::File, grabbing the last 20 lines is simply grabbing the last 20 elements of the array.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: how to populate array with last 20 lines of file
by ytjPerl (Scribe) on Aug 08, 2017 at 19:51 UTC |
In Section
Seekers of Perl Wisdom