Jeri has asked for the wisdom of the Perl Monks concerning the following question:
Hi! I'm trying to find the size of a nested hash in a HoH. Here i what I've written.
sub ResetHashProteinTally { my ($rHoH_ProteinFamilies) = @_; #capturing array for my $proteinfamily ( keys %{$rHoH_ProteinFamilies} ) { my $size = (keys %{$rHoH_ProteinFamilies->{proteinfamily}}); #--- +-> finds the length of a hash print "$size\n"; } } #end of sub routine ResetHashProteinTally
Here is the output I'm getting.
0 0 0
(There are only 3 nested hashes in the initial data set I'm working with.)
I'm still new to working with HoHes so I've been coming across a couple conceptual problems like this. Thanks in advance.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Finding the size of a nested hash in a HoH
by moritz (Cardinal) on Nov 10, 2011 at 14:26 UTC | |
by Jeri (Scribe) on Nov 10, 2011 at 14:27 UTC | |
Re: Finding the size of a nested hash in a HoH
by mrstlee (Beadle) on Nov 10, 2011 at 16:11 UTC | |
by BrowserUk (Patriarch) on Nov 10, 2011 at 16:21 UTC | |
by aaron_baugher (Curate) on Nov 10, 2011 at 16:55 UTC | |
by BrowserUk (Patriarch) on Nov 10, 2011 at 17:16 UTC | |
by remiah (Hermit) on Nov 11, 2011 at 07:51 UTC | |
| |
by aaron_baugher (Curate) on Nov 11, 2011 at 14:59 UTC |