mvkarthik has asked for the wisdom of the Perl Monks concerning the following question:
Here: ehm_count is the hash that I want it to be local to the main procedure and same needs to be used during recursive calls as well . I dont see it happening. Please help. Thanks, -Karthiksub get_lower_level_ehms_count() { my %design_hash = %{@_[0]}; local %ehm_count; ##Checking if the design has embedded SMSes if($design_hash{'EMBEDDED_HMS'}) { my @ehms = @{$design_hash{'EMBEDDED_HMS'}}; ##Getting +the list of EHMs under the current DHM foreach(@ehms) { my %ehm_hash = %{$_}; my $design_top = $ehm_hash{'TOP'}; if($ehm_hash{'EMBEDDED_HMS'}) { &get_lower_level_ehms_count(\%ehm_hash +); } if(!($ehm_count{$design_top})) { $ehm_count{$design_top} = @{$ehm_hash{ +'INSTANCES'}}; } else { my $count = $ehm_hash{$design_top}; my $instances = @{$ehm_hash{'INSTANCES +'}}; $count = $count + $instances; $ehm_count{$design_top} = $count; } } } return \%ehm_count; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Updating the same hash using recursion
by Athanasius (Archbishop) on Aug 20, 2014 at 06:24 UTC | |
|
Re: Updating a same hash using recurrsion ...
by 2teez (Vicar) on Aug 20, 2014 at 06:10 UTC | |
|
Re: Updating a same hash using recurrsion ...
by NetWallah (Canon) on Aug 20, 2014 at 14:41 UTC |