Hi, I have a simple code below:
sub 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; }
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, -Karthik

In reply to Updating a same hash using recurrsion ... by mvkarthik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.