in reply to Tidier and more efficient parsing code
my $data = []; my $section = 0; while (<TEXT>) { if (/^section(\d)/) { $section = $1; } else { next unless $section; push (@{$data->[($section - 1)]}, $_); } } #my @section_one = @{$data->[0]}; # if absolutely #my @section_two = @{$data->[1]}; # neccessary only
|
---|