#!/usr/bin/perl use strict; use warnings; while (<>) { next if 1 .. /^END$/; if (/^START$/ .. /^END$/) { next if /^START$/; last if /^END$/; print; } }