To have what you want (i.e. one amount for each customer), the bottom line is to use a hash. Since you already have a hash, we could say that you are done... unless your current hash is too complicated for what you want to do. In this case, you need to make a second less complex hash, for example using the code provided earlier by
AppleFritter. At the end you would get a simple hash looking like this:
0 HASH(0x6005e8d88)
'cust1' => 10
'cust2' => 20
'cust3' => 30
I must say that I am not quite sure to understand what your current data structure really is (and will therefore not supply additional code right now), it would be good if you could explain further (perhaps using the output produced by Data::Dumper on your root hash).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.