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

Re^2: What is $x{$y}?

by AnomalousMonk (Abbot)
on Sep 11, 2012 at 00:22 UTC ( #992880=note: print w/ replies, xml ) Need Help??

in reply to Re: What is $x{$y}?
in thread What is $x{$y}?

In the  $x{ @y } expression, array  @y is being evaluated in scalar context, i.e., it yields the number of elements of the array. This number is then stringized as a key for the hash.

>perl -wMstrict -le "my %hash = qw(one uno two dos); my @y = 5 .. 8; ;; print 'scalar @y: ', scalar @y; print 'does not exist' if not exists $hash{ @y }; ;; $hash{ '4' } = 'four'; print 'does exist: ', qq{'$hash{ @y }'} if exists $hash{ @y }; " scalar @y: 4 does not exist does exist: 'four'

Comment on Re^2: What is $x{$y}?
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992880]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2014-12-26 05:16 GMT
Find Nodes?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?

    Results (165 votes), past polls