gnu@perl has asked for the wisdom of the Perl Monks concerning the following question:
I have already done this:
open(FILE,'/var/adm/messages'); my @arr = (<FILE>); print reverse(@arr);
This works, but I am kind of concerned about loading a HUGE file into @arr. So I tried this:
open(FILE,'/var/adm/messages'); print reverse(<FILE>);
In the actual 'print' segments I would use a counter to limit the lines printed to the number requested.
What other way would you recommend to get a 'tail' of a file.
TIA, Chad.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: tail a file in perl
by broquaint (Abbot) on Oct 23, 2002 at 14:19 UTC | |
Re: tail a file in perl
by jwest (Friar) on Oct 23, 2002 at 14:33 UTC | |
Re: tail a file in perl
by roik (Scribe) on Oct 23, 2002 at 14:18 UTC | |
Re: tail a file in perl
by SarahM (Monk) on Oct 23, 2002 at 14:25 UTC | |
by blokhead (Monsignor) on Oct 23, 2002 at 17:22 UTC | |
Re: tail a file in perl
by Jaap (Curate) on Oct 23, 2002 at 15:25 UTC |