I am writing a perl program to extract lines that are in between the two patterns i am matching. for example the below text file has 6 lines. I am matching load balancer and
For files like this, I often use a change in the Record Separator ( $/ or $RS from English )
$/
$RS
use English qw<$RS>; local $RS = "\nend\n"; my $record = <$open_handle>;
When you chomp it, you get rid of that line.
chomp
chomp( $record );