in reply to Grab last line and print

I see no mention to Tie::File. With this module, you can use your file as a Perl array.

use Tie::File; tie @array, 'Tie::File', $filename or die $!; print $array[-1];

But remember: this will open your file in read/write mode, so any modifications you make in array will reflect on file's data. Use this way for read-only access:

use Tie::File; use Fcntl 'O_RDONLY'; tie @array, 'Tie::File', $filename, mode => O_RDONLY or die $!;

Igor 'izut' Sutton
your code, your rules.