in reply to Re: Regular Expressions Challenge
in thread Regular Expressions Challenge

So here is an example using the flip-flop operator - however I am not certain what the OP is actually looking for:
use strict; use warnings; use Data::Dumper; my @sections; while (<DATA>) { chomp; if (/===Comments===/../^[^=]/) { if (/===Comments===/) { push @sections,[] } else { push @{$sections[-1]}, $_ if $_ } } } print Dumper(\@sections);
Which for the supplied data gives:
$VAR1 = [ [ 'User comments are added here. A user may write whatever t +hey may wish.' ], [ 'Comments are related to the microarray data here.' ], [ 'Comments related to the pathway information here.' ] ];