in reply to Print all lines between to keywords

This is a solution that depends on the fact that range operators return a 'sequence number' (see Range Operators in perlop). The advantage, such as it is, is that only one (possibly expensive) regex match is performed per line, the numeric comparison and the match against  /E0$/ being assumed to be insignificantly cheap. The file  806007.dat contains the data from the OP plus a few  'ignore ...' lines at the very beginning.
>perl -wMstrict -e "open my $fh, '<', '806007.dat' or die qq{opening: $!}; my $linesFromFile = [ <$fh> ]; close $fh or die qq{closing: $!}; for (@$linesFromFile) { next unless my $seq_n = /^StartTr1/ .. /^oflTr1/; print unless $seq_n < 2 or $seq_n =~ /E0$/; } " 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
Note that the  while (<DATA>) { ... } form given by toolic is preferred for this sort of file processing. I have assumed that there is a need to read the entire file before processing it, as is done in the OP, and have given the code in this form.