Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: What is $x{$y}?

by Rudolf (Pilgrim)
on Sep 10, 2012 at 19:44 UTC ( #992840=note: print w/replies, xml ) Need Help??


in reply to What is $x{$y}?

Like it was said above, it is a dereference because a hash only holds scalar values which could be references to an array, hash, or another scalar.. any reference. $x{$y} grabs the reference which is your scalar that you must dereference to make sense out of it.

Just like my $ref = \@ary; creates a reference to the array and the way you would dereference it would be either @$ref or @{$ref}. In the case of a complex variable such as $x{$y} it is probably easier and more readable (once you get used to it) to use surrounding curly braces.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992840]
help
Chatterbox?
erix just did a 12 km-run. Slow, but unstoppable!
[choroba]: My recent record is 10km in 1 hour :)
[perldigious]: Nice erix... perldigious' legs are so sore from portaging his kayak from place to place last weekend he can barely hobble 12m. :-)
[erix]: you're faster than me then :)
[erix]: well, at the moment, that is :)
[erix]: I should lose some weight although I keep telling myself that I'm doing extra training by lugging it along
[erix]: I saw a common kingfisher and a couple of bullfinches

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2017-05-24 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?