in reply to Read n lines from the top of a text file
$ cat file.txt | perl -ne '(1..10)&&print' [download]
or
#!/usr/bin/perl my $counter; open A, 'file.txt'; while(<A>) { print if ($counter++ < 10); } close A; [download]