my $switch; while (){ $switch = $. if /SCHEDULE "DUMMY CHECK"/; if ( $switch and $. <= $switch + 6){ print; } }