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; }