Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Keys and Values from Hash

by Laurent_R (Canon)
on Jul 18, 2014 at 17:53 UTC ( [id://1094239]=note: print w/replies, xml ) Need Help??


in reply to Keys and Values from Hash

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).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1094239]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 04:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found