Eelco,
Since your script reads the whole file into an array, that will certainly
cause trouble if the file is big enough. (Because you'll run out of memory.)
The script below should work on any size file -- just tested it on a 500 Mb
data file. Maybe it's not elegant, but it seems fast enough.
R
Hi Eelco,
This solution requires the File::Tail module available from CPAN
(File::Tail, in turn, requires Time::HiRes):
use File::Tail;
# File to read from
my $text_file = '/www/logs/error_log';
# Number of lines to read from end of file
my $num_lines = 25;
# Create a new File::Tail object sta