in reply to array of arrays calculations
Why not just do the calculation right in the SQL?
select h.cus, h.ta, h.gd1 - c.gd1 as diff1, h.gd2 - c.gd2 as diff2, from hist h, hist c where h.cus = c.cus and h.ta = c.ta order by h.cus, h.ta
WARNING: not tested! YMMV!
What can be asserted without proof can be dismissed without proof. - Christopher Hitchens
In Section
Seekers of Perl Wisdom