Thanks a lot Anonymous Monk.You rock!!!
This logic worked.Below is the final code :-
open (FILE, '<', 'sample.txt') or die "Could not open sample.txt:
+$!";
open (FILE1, ">output1.txt") or die "Could not open sample.txt: $!
+";
my @nums = <FILE>;
my $start = "print from";
my $go = 0;
my $sizeconf = scalar @nums;
for my $num ( @nums ){
if ($num =~ /$start/)
{
$go = 1;
}
if($go){
print FILE1 "$num";
}
my $end = "closing";
if ($num =~ /$end/ && $num !~ /$start/)
{
$go = 0;
}
}
The last point of "$num =~ /$end/ && $num !~ /$start/" because in my actual input file $start conatins the staring $end.
I will intergrate this logic with my tool and update you.