Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Help with Hash of hashes, is there a better way?

by ikegami (Patriarch)
on Jun 01, 2006 at 09:24 UTC ( [id://553004]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Help with Hash of hashes, is there a better way?
in thread Help with Hash of hashes, is there a better way?

Option 2)

A callback would be simpler:

{ iterate { my ( $env_name, $platform_name, $host_name, $target_name, $total_capacity, $free_capacity, ) = @_; local $, = "\t"; local $\ = "\n"; print $env_name, $platform_name, $host_name, $target_name, $total_capacity, $free_capacity; } $stuff; }
sub iterate(&$) { my ($callback, $envs) = @_; while (my ($env_name, $platforms) = each %{$envs }) { while (my ($platform_name, $hosts ) = each %{$platforms}) { while (my ($host_name, $targets ) = each %{$hosts }) { while (my ($target_name, $target ) = each %{$targets }) { my $total_capacity = $target->{total_capacity}; my $free_capacity = $target->{free_capacity}; $callback->( $env_name, $platform_name, $host_name, $target_name, $total_capacity, $free_capacity, ); }}}} }

Tested.

Replies are listed 'Best First'.
Re^4: Help with Hash of hashes, is there a better way?
by TeraMarv (Beadle) on Jun 01, 2006 at 10:16 UTC

    Thanks ikegami,

    I like it, very cool. Something I would never have come up with myself....well at least not this year ;-)

    That's what I love about perlmonks, you always learn something useful.

    Thanks again....to all Monks

Log In?
Username:
Password:

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

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

    No recent polls found