in reply to Re: how to print first 5 lines of a file
in thread how to print first 5 lines of a file

Nice, but that still loops over the entire file... I'd exit out of the loop after the fifth line like so:
while(<>) { 1 .. 5 ? print : last; }

-Blake