in reply to Regular expression...
#!/usr/bin/perl use strict; use warnings; open IN,"StartEnd.txt" or die $!; open OUT,'>', "StartEnd_out.txt" or die $!; my $bol = 'FALSE'; while(<IN>){ if(/^=begin/){ $bol = 'TRUE'; } elsif(/^=end/){ $bol = 'FALSE'; } elsif($bol eq 'TRUE'){ print OUT $_,"\n"; } } close(IN); close(OUT);
|
---|