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

Re: Confused about accessing hashes

by RazorbladeBidet (Friar)
on Apr 19, 2005 at 14:18 UTC ( #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
Node Status?
node history
Node Type: note [id://449255]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2020-10-27 07:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (256 votes). Check out past polls.

    Notices?