in reply to Re^2: Perl Hash
in thread Perl Hash
To get the grand totals, add the following as the last line inside the WHILE loop:
This is a kludgy way to do it, but, given your sparse data definition, it does put out a grand total.$h{$k1}{$k2}{+substr($k3,0,10) . " Grand Total"} += $val;
A more robust implementation would require one more level of hashing - I leave that as an exercise for you to implement.
"I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
-- Dr. Cox, Scrubs
|
|---|