[DFW.pm] Adding variables together based on commonality of different variable

Lisa Cloutier staurofilax77 at gmail.com
Tue Mar 25 09:12:35 PDT 2014

Hi All,

This should be easy and I've done similar things before, but I can't seem
to get the data structure to output properly.

I have data in the following format:

Market1 65000 3000
Market1 130000  5000
Market1 65000   4500
Market2 65000  3000
Market3 32000  800
Market3 32000  1000

What I need to do is get the markets so that they are unique so that I can
use them as hash keys.  So I need to add all of the 2nd column and all of
the 3rd column for each market so that there is only one entry per market,
with the duplicate entries all added together.

The data is coming out of an arrayref (from an Oracle database) so I don't
have any code that shows the problem, just the foreach loop iterating
through each reference in the arrayref.

Any help would be greatly appreciated.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/dfw-pm/attachments/20140325/0637ffdd/attachment.html>

More information about the Dfw-pm mailing list