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

Re^2: Difference in Hash Declaration

by jwkrahn (Monsignor)
on May 07, 2012 at 11:02 UTC ( #969241=note: print w/ replies, xml ) Need Help??

in reply to Re: Difference in Hash Declaration
in thread Difference in Hash Declaration

Parenthesis () creates LIST:
print 1, 'b', 3, 'd', 5, 'f', "\n";

I see a list there but I don't see any parentheses.

my @stuff = map $_ + 2, 6, 7, 8, 9, 10;


Parentheses are used for precedence.

my %h = ( 1 => 'j', 2 => 'b' );

There the assignment operator has higher precedence than the comma operator so the parentheses are required.

Comment on Re^2: Difference in Hash Declaration
Select or Download Code
Replies are listed 'Best First'.
Re^3: Difference in Hash Declaration
by anazawa (Scribe) on May 07, 2012 at 12:25 UTC
    I agree with you. Parentheses don't create LIST, are used for precedence. I'm glad you pointed out my mistake :)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2015-11-25 07:06 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (672 votes), past polls