use warnings; use strict; my $linesSinceBreak = 0; while () { chomp; $linesSinceBreak = 0, print "\n<= 15 && ! length $_; print "$_\n"; }