in reply to Simulating UNIX's "tail" in core Perl

Well, the simplest way to tail a file is to actually just use tail. But I guess this would only work if you are on a Unix platform. You didn't mention what platform you were on, but for those who might find this useful:
my @lines=`tail logfile.txt`;
One line - can't get much simpler than that. By the way, those are back quotes, not single quotes. If you've never used them before, backquotes will execute whatever is within them like it is at the command prompt, then will return the resulting lines as an array. And whatever command you send has to exist on your system. I really don't know what backquotes do on Mac or Win.

Replies are listed 'Best First'.
Re: Re: Simulating UNIX's "tail" in core Perl
by Anonymous Monk on Mar 07, 2001 at 15:56 UTC
    my thoughts exactly. I had a similar situation and just used tail within backquotes. you can control the lines outputted with tail just as you would on the command line.