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

well, if you're not too worried about file size, just read the whole file into an array, and pop() off as many lines as you need. Course, that won't be the most optimal solution on large files. i.e.

my @file = <FILE>; for( my $i=0; $i<$MAXLINES; $i++ ) { print pop @file; }

Replies are listed 'Best First'.
Re: Re: Simulating UNIX's "tail" in core Perl
by hurstdog (Initiate) on Mar 07, 2001 at 05:40 UTC
    hmm... guess I shoulda read you're original post more clearly, mostly the part about how the file will be "really large" ;-) oh well...