We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0653d31 commit 0364b59Copy full SHA for 0364b59
doc/Language/variables.pod6
@@ -120,10 +120,10 @@ larger expression determines the assignment type:
120
my ( @array, $num );
121
@array = $num = 42, "str"; # list assignment
122
say @array.perl; # OUTPUT: «[42, "str"]»
123
- say $num.perl; # OUTPUT: «[42, "str"]»
+ say $num.perl; # OUTPUT: «42»
124
125
-This is because the whole expression is C<@array = $num = 42, "str">, while
126
-C<$num = 42> is not is own separate expression.
+The assignment expression is parsed as C<@array = (($num = 42), "str")>,
+because item assignment has tighter precedence than the comma.
127
128
See L<operators|/language/operators> for more details on precedence.
129
0 commit comments