Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: hashes with multiple keys

by artist (Parson)
on Feb 27, 2009 at 21:24 UTC ( #747031=note: print w/ replies, xml ) Need Help??


in reply to hashes with multiple keys

I guess you might need following output:

host1:
vol1: 10g
vol2: 20g
vol3: 30g
total:60h

host2:
vol4:30g
vol5:20g
vol2:20g
total:70g

You should have data structure:
$VOLUMES = { vol1 => '10' , vol2 => '20', ... }; $HOSTS = { host1 => [qw(vol1 vol2 vol3), host2 => [qw(vol4 vol5 vol2)], ... };
Iterate each host from $HOSTS (in sorted order) and iterate for each volume and get the values from other hash. and total them for capacity. </code>
--Artist


Comment on Re: hashes with multiple keys
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2015-07-29 14:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls