in reply to Read Last Line of A File Only

I like File::ReadBackwards' object oriented interface. ...and just for the fun of it, here's a somewhat golfy usage of that interface:

use File::ReadBackwards; print +( File::ReadBackwards-> new( 't1000f.txt' ) || die $! )->readline();

Of course, you'll need to alter the filename to whatever file it is that you're trying to read. On my system, t1000f.txt is a newline delimited text file listing the top 1000 most common English words in common speech, sorted in descending order by frequency of use. It turns out that 'neck' is #1000. :)


Dave