in reply to Reading in the first 10 lines of a file

perl -e 'print +(<ARGV>)[0..9]' myfile.txt

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Reading in the first 10 lines of a file
by trizen (Hermit) on Dec 10, 2011 at 23:57 UTC
    Not recommended! Slurps the entire file into memory...
      Yes, I know.

      Memory is plenty and cheap :) and my fingers are clumsy and lazy :D

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James