"be consistent" | |
PerlMonks |
Re: The behavior when assigning an array to scalar?by choroba (Cardinal) |
on Sep 26, 2017 at 09:52 UTC ( [id://1200101]=note: print w/replies, xml ) | Need Help?? |
That's because the comma operator in scalar context returns the second argument. See perlop for details. Update: Also, one interesting case is missing in your question:
It prints 111, becuase of precedence of the two operators involved, the comma and equal sign. In fact, the parentheses in the $s case were used only to change the precedence.
In Section
Seekers of Perl Wisdom
|
|