while () { # logic crystal clear here next unless /$START/ .. /$STOP/; # next if /$START/; # exclude line with START pattern next if /$STOP/; # exclude line with STOP pattern print; }