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.
In reply to Re: how to populate array with last 20 lines of file
by dasgar
in thread how to populate array with last 20 lines of file
by ytjPerl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |