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):
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 here's a quick synopsis that (hopefully) helps (note that this is not complete):
If you work to combine those, then you should be able to access anything wrt hashes/arrays/keys.Prepending: $ - a single item (scalar) @ - multiple items (array) % - hash Accessors: -> - dereference [] - array subscript {} - hash key
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."
"But what of all those sweet words you spoke in private?"
"Oh that's just what we call pillow talk, baby, that's all."
In Section
Seekers of Perl Wisdom