perl -pe 'BEGIN{ $lines = 10 } last if $. > $lines' < file