in reply to Print all lines between to keywords

To exclude the start and end text...
use strict; use warnings; while (<DATA>) { if ( /^StartTr1/ .. /^oflTr1/ ) { print unless (/^StartTr1/) or (/^oflTr1/); } } __DATA__ StartTr1 sample 1 sample 1 sample 1 sample 1 SAMPLE 1 oflTr1 nothing nothing nothing StartTr1 sample 2 sample 2 sample 2 sample 2 sample 2 last line before sample 2 oflTr1 junk junk junk

prints:

sample 1 sample 1 sample 1 sample 1 SAMPLE 1 sample 2 sample 2 sample 2 sample 2 sample 2 last line before sample 2