On Jan 24, 2008 9:07 AM, <[EMAIL PROTECTED]> wrote:
> I'd like to get the number of keys in hash of hashes. I know that I
> can do something like $count = keys( %myHash ), but how would I go
> about finding the number of keys in a sub-hash?
my $count = keys %{ $sub_hash_reference };
You can replace $sub_hash_reference with any expression that returns
the reference to your sub-hash, such as $myHash{fred}, say.
> Alternately, how could I loop through keys in a hash of a hash?
foreach my $key (keys %{ $sub_hash_reference }) { ... }
Hope this helps!
--Tom Phoenix
Stonehenge Perl Training
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/