Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: scalar in list context

by chromatic (Archbishop)
on Jan 26, 2010 at 23:00 UTC ( [id://819799]=note: print w/replies, xml ) Need Help??


in reply to Re: scalar in list context
in thread scalar in list context

There is no difference between @list= 1,2,3,4; and @list=(1,(2,3,(4)));

Careful! Precedence makes a big difference between those two. You're thinking of @array = (1, 2, 3, 4) versus @array = (1, (2, 3, (4))).

Replies are listed 'Best First'.
Re^3: scalar in list context
by LanX (Saint) on Jan 26, 2010 at 23:19 UTC
    Wow thanks a lot.

    Indeed, the = has a higher precedence than comma ...

    UPDATE: what I really wanted to show is that  sub list1 { 1,2,3,4 } and  sub list2 { (1,(2,3,(4))) } return the same result. The parens are not necessary to produce a list but are saver and often better to read...

    Cheers Rolf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-23 23:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found