Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
We don't bite newbies here... much
 
PerlMonks  

Re: Confused about accessing hashes

by RazorbladeBidet (Friar)
on Apr 19, 2005 at 10:18 UTC ( [id://449255]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Confused about accessing hashes

Might want to try perlreftut because those are actually hash references :)

But here's a quick synopsis that (hopefully) helps (note that this is not complete):
Prepending: $ - a single item (scalar) @ - multiple items (array) % - hash Accessors: -> - dereference [] - array subscript {} - hash key
If you work to combine those, then you should be able to access anything wrt hashes/arrays/keys.

e.g. - $var1->{$var2}->[$var3]
would return one element (the prepended $)
from var1
which is a reference (->)
to a hash ( {}'s )
with a key $var2
whose value is a reference (->)
to an array ([]'s)
with an index $var3

I hope that is more helpful than confusing :) The perldocs are much more complete.

This is a rudimentary example, not intended to be 100% complete (fileglobs, lists, etc.) so please don't jump all over it (this addressed to the monastery at large :) )
--------------
"But what of all those sweet words you spoke in private?"
"Oh that's just what we call pillow talk, baby, that's all."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://449255]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.