my @output; foreach (@array) { push @output, $_ unless /HEAD/ .. /TAIL/; }