Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Elaborate a bit on comma versus parentheses
  • Loading branch information
lizmat committed Jun 12, 2018
1 parent b1bfd97 commit 54365a6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion doc/Language/5to6-perlop.pod6
Expand Up @@ -28,7 +28,17 @@ L<Operator Precedence|/language/operators#Operator_Precedence>.
The things listed in Perl 5's C<perlop> document as unary and list operators in
this section tend to be things that can also be thought of as functions, such
as C<print> and C<chdir>. As such, you can find information about them in
the L<functions|/language/5to6-perlfunc> guide. Parentheses are still used for grouping.
the L<functions|/language/5to6-perlfunc> guide. Parentheses are still used for
grouping. There is one caveat: in Perl 6, it's the C<,> (comma) that creates
lists, B<not> parentheses. So:
=begin code
my @foo = 1,2,3,4,5; # no parentheses needed
.say for 1,2,3,4,5; # also no parentheses
my $scalar = (1); # *not* a list, as there is no comma
my $list = (1,); # a List in a scalar container
=end code
=head2 The Arrow Operator
Expand Down

0 comments on commit 54365a6

Please sign in to comment.