Use <code> tags, not <DATA>.
To get the grand totals, add the following as the last line inside the WHILE loop:
$h{$k1}{$k2}{+substr($k3,0,10) . " Grand Total"} += $val;
This is a kludgy way to do it, but, given your sparse data definition, it does put out a grand total.
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
| [reply] [d/l] |