in reply to how to print first 5 lines of a file

maybe the following untested solutions. Beware, numbers 2 and 3 are a bit on the silly side. :
  1. perl -pe 'exit if ($. > 5);'
  2. #!/usr/bin/perl -w use strict; my $cnt = 0; while (my $line = <>) { chomp($line); $cnt++; if ($cnt > 5) { next; } else { print "$line\n"; } }
  3. use strict; open(PRINT,"| lp") || die "Could not start lp : $!\n"; while (my $line = <>) { print PRINT $line; last if ($. > 5); } close(PRINT);

i had a memory leak once, and it ruined my favorite shirt.