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

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2014-09-16 15:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (32 votes), past polls