#!/usr/bin/perl ## Go through a stream and prints all but the last n lines where n is a command line argument: my @cache; my $n = shift @ARGV; while(<>) { push @cache, $_; print shift @cache if @cache > $n; }