in reply to Re: Regular Expressions Challenge
in thread Regular Expressions Challenge
Which for the supplied data gives: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);
$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.' ] ];
|
|---|