This code is all well and good, except it takes the information after the end of each comments section also. I need to take only the information within each comments section (e.g. between ===Comments=== and =Microarray Data=). Sorry if that wasn't clear.
my @data = split /\n/, $str;
my @section;
my $i = 0;
while (@data) {
$_ = shift @data;
if (/^===Comments===$/) {
while (@data) {
$_ = shift @data;
last if /^=/;
$section[$i] .= "$_\n";
}
$i++;
}
}