Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Updating a same hash using recurrsion ...

by NetWallah (Canon)
on Aug 20, 2014 at 14:41 UTC ( [id://1098124]=note: print w/replies, xml ) Need Help??


in reply to Updating a same hash using recurrsion ...

Untested, simplified code suggestion:
sub get_lower_level_ehms_count { my %design_hash = %{$_[0]}; my %ehm_count ; my $embedded = $design_hash{'EMBEDDED_HMS'} or return \%ehm_co +unt; for my $emb (@$embedded) { my $design_top = $emb->{'TOP'}; if($emb->{'EMBEDDED_HMS'}) { $lower_levels = get_lower_level_ehms_count($emb); $ehm_count{$_} += $lower_levels->{$_} for keys %$l +ower_levels; } $ehm_count{$design_top} += scalar @{$emb->{'INSTANCES'}}; } return \%ehm_count; }

        "You're only given one little spark of madness. You mustn't lose it."         - Robin Williams

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1098124]
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-16 22:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found