Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Confused about accessing hashes

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


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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found