Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Direct reference to any element in a hash-of-hash

by ioannis (Prior)
on Jun 15, 2006 at 12:46 UTC ( #555486=note: print w/replies, xml ) Need Help??


in reply to Direct reference to any element in a hash-of-hash

When you access a HoH this way, a random child-hash is printed; the is no guaranty it will be the first child-hash because the hash has no concept of element ordering. You will receive a random element.
# All these are random accesses. my ( $any ) = values %$hoh; print "source: ", ${[values %$hoh]}[0]{source};

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://555486]
help
Chatterbox?
[msh210]: *finally* tracked down the source of nonsensical results: I had sum0 (@ary / $foo) instead of (sum0 @ary) / $foo

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2017-01-17 17:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (158 votes). Check out past polls.