in reply to Newbie: query about array assignment

@stuff = "This","That","Other";

When I first saw this and other, similar code fragments in this thread, my first expectation was that the comma expression  "This","That","Other" would evaluate to the right-most list item, "Other". After all, that's the rule: Evaluate left side, throw away, return right side in left-associative fashion.

After a bit of thought, I realized that the rule is to evaluate the leftmost expression, toss the result, evaluate and return the result of the rightmost expression, left-associative. Of course, the leftmost expression has a side effect: it creates and initializes the  @stuff array. The following helped me elucidate the process:

>perl -wMstrict -MO=Deparse,-p -le "my @stuff = 'One', 'Two', 'Three'; print qq{(@stuff)}; ;; my @stoff = scalar('Eine', 'Zwei', 'Drei'); print qq{(@stoff)}; ;; my @sniff = scalar(my @snarf = '111', '222', '333'); print qq{sniff: (@sniff) snarf: (@snarf)}; ;; my @stiff = ('Uno', 'Dos', 'Tres'); print qq{(@stiff)}; " Useless use of a constant (Eine) in void context at -e line 1. Useless use of a constant (Zwei) in void context at -e line 1. Useless use of a constant (222) in void context at -e line 1. Useless use of a constant (Two) in void context at -e line 1. Useless use of a constant (Three) in void context at -e line 1. BEGIN { $^W = 1; } BEGIN { $/ = "\n"; $\ = "\n"; } use strict 'refs'; ((my(@stuff) = 'One'), '???', '???'); print("(@stuff)"); (my(@stoff) = scalar(('???', '???', 'Drei'))); print("(@stoff)"); (my(@sniff) = scalar(((my(@snarf) = '111'), '???', '333'))); print("sniff: (@sniff) snarf: (@snarf)"); (my(@stiff) = ('Uno', 'Dos', 'Tres')); print("(@stiff)"); -e syntax OK >perl -wMstrict -le "my @stuff = 'One', 'Two', 'Three'; print qq{(@stuff)}; ;; my @stoff = scalar('Eine', 'Zwei', 'Drei'); print qq{(@stoff)}; ;; my @sniff = scalar(my @snarf = '111', '222', '333'); print qq{sniff: (@sniff) snarf: (@snarf)}; ;; my @stiff = ('Uno', 'Dos', 'Tres'); print qq{(@stiff)}; " Useless use of a constant (Eine) in void context at -e line 1. Useless use of a constant (Zwei) in void context at -e line 1. Useless use of a constant (222) in void context at -e line 1. Useless use of a constant (Two) in void context at -e line 1. Useless use of a constant (Three) in void context at -e line 1. (One) (Drei) sniff: (333) snarf: (111) (Uno Dos Tres)