my $counter; print"TOP\n"; while( (<>) && counter <10){ $counter++; print"$_\n"; } print "BOTTOM";