while( <> ){ print; # bail if past 10 lines # or if we hit a blank line last if $. >= 10 || $_ eq "\n"; }