Keeping a count of elements in an array in Perl has rather a bad smell. Instead you could:
my @records; while (<DATA>) { if ($_ =~ /^-/) { # New record push @records, []; next; } next if !@records; push @{$records[-1]}, $_; }
In reply to Re^2: Split file output into array of arrays
by GrandFather
in thread Split file output into array of arrays
by spickles
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |