#!/usr/bin/perl -w use strict; my $cnt = 0; while (my $line = <>) { chomp($line); $cnt++; if ($cnt > 5) { next; } else { print "$line\n"; } }
use strict; open(PRINT,"| lp") || die "Could not start lp : $!\n"; while (my $line = <>) { print PRINT $line; last if ($. > 5); } close(PRINT);
In reply to Re: how to print first 5 lines of a file
by MZSanford
in thread how to print first 5 lines of a file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |