in reply to peeling the top 10 lines from a file

$counter is mis-typed within your while expression. It's missing its '$' sigil. Also, I think that some of the magic of while(<>) is lost when you put other criteria within the while() criteria.

You could do it like this...

print "TOP\n"; while( <> ) { last if $. > 10; # $. is the current line number within the file. print "$_\n"; } print "BOTTOM\n";

Dave