in reply to Multi-Column Totals

if you dont know in advance how many elements are in an array that you want to loop through, a couple of approaches may work:
foreach my $row (@rows) { ... }
will loop through each row, but then you lose the row number that you're on, if thats important. Also, this approach creates an anonymous array for the foreach to loop through. With big arrays this can be memory expensive.

Another approach that avoinds these issues is this:
for my $i (0 .. $#rows) { ... # something with $rows[$i] }
This approach just asks the array how big it is, and then may proceed like your original code.
Hope this is what you're asking for.