http://www.perlmonks.org?node_id=993493


in reply to Newbie: query about array assignment

"=" has a higher precedence than ",", thats why you need the parens.

DB<104> dp @stuff = "This","That","Other"; { ((@stuff = 'This'), 'That', 'Other'); } DB<105> dp @stuff = ("This","That","Other"); { (@stuff = ('This', 'That', 'Other')); }

UPDATE: the following example shows that you (almost) never really need parens for lists, it's just precendence:

DB<111> sub list { "This","That","Other" } DB<112> @stuff = list() => ("This", "That", "Other")

Cheers Rolf

PS: don't be confused "dp" is my personal debugger-macro for using B::Deparse (with -p option to show parens)