in reply to Re: Split file output into array of arrays
in thread Split file output into array of arrays
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]}, $_; }
|
|---|