I'm trying to write a script to read all files in a directory and then print the last line of each file unless its blank and I'm using File::ReadBackwards for this. How do I do that or is there a better way? Here's what I have so far:

Other possible ideas, much less likely to be what you need: - Loading into an array the output of the tail fonction under Unix/Linux; - if the file is small enough, slurping it into an array and taking the last record; - reading though the file and always remembering the previous line; - reading the file stats (especially the size) and using the seek function to get near the end (very feasible if you have a good idea of the usual line length).