in reply to Re: array of arrays
in thread array of arrays
Hello kevbot:
Thank you for your solution. Since this task is for me to learn, took me a while to study one by one from the bottom up. Yours was the last.
I would like to know if it is possible for you to show me how print on the fly each row of the while loop with the array size and the sum total of each array.
Something like this:
my %data; $e = '0'; while(<$fh>){ $e++; chomp $_; my ($key, $val) = split(/\|/, $_); push @{$data{$key}},$val; $Grand_Total += "$val"; my $size = scalar(@{$data{$key}}); ## WRONG doesn't print $Sub_Total[$key] += $data{$key}[$val]; ## WRONG doesn't prin +t print"Row ($e) / Array Size [$size] key ($key) / Amount ($val +) / Sub Total ($Sub_Total[$key]) / Grand_Total = ($Grand_Total)<hr>" +; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: array of arrays
by huck (Prior) on Jun 12, 2017 at 23:04 UTC | |
|
Re^3: array of arrays
by kevbot (Vicar) on Jun 13, 2017 at 05:33 UTC |