Yes - a small queue would do this. Since you're so new, you'll do yourself a world of good by picking up a copy of the inexpensive book Learning Perl (also known as the Llama book) from O'Reilly.
while (<>) { push @queue, $_; print shift @queue if @queue > 2; }
In reply to Re: Print all lines in a file except the last two
by diotalevi
in thread Print all lines in a file except the last two
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |