Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks!
I am looking for an efficient way to grab the last 2 lines of a big text file...
Ideally, I would like to store the second-to-last line to a variable called $id and the last line to a variable called $name.
Of course I can read the file line-by-line but I was wondering if there is a faster way to do it, perhaps without the need of reading the whole file first.
I am looking for an efficient way to grab the last 2 lines of a big text file...
Ideally, I would like to store the second-to-last line to a variable called $id and the last line to a variable called $name.
Of course I can read the file line-by-line but I was wondering if there is a faster way to do it, perhaps without the need of reading the whole file first.
Back to
Seekers of Perl Wisdom