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

here's a quick one liner that you can stick in the middle of something (F is an open filehandle, $counter is predefined as 0):
do { ($counter++ < 11) ? print : last } while (<F>)
be sure to close F.
  • Comment on Re: Reading in the first 10 lines of a file