Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Retrieving data from multidimensional hashes

by friedo (Prior)
on Aug 11, 2008 at 18:54 UTC ( #703717=note: print w/ replies, xml ) Need Help??


in reply to Retrieving data from multidimensional hashes

A couple of options, depending on what appeals to you:

my $num = keys %{ $hash{key} }; # or my $ref = $hash{key}; my $num = keys %$ref;
The first one is short-hand for accessing the second-level hash directly, though I find it a tad ugly, especially if the structures get deeper than two levels. The second one grabs the reference for the second level hash and then calls keys on that, which is a bit more explicit.


Comment on Re: Retrieving data from multidimensional hashes
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://703717]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2015-07-03 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (56 votes), past polls