Skip to content

Commit 5a09ded

Browse files
shlomifzoffixznet
authored andcommitted
Document the proper way to concat arrays. (#1617)
In 5to6 - it was not properly documented. Also spell "," as the comma. This got me tripped when working on perl6-examples.
1 parent 36fb977 commit 5a09ded

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

doc/Language/5to6-nutshell.pod6

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ for full details on all operators.
567567
568568
Unchanged:
569569
570-
=item C<,> List Separator
571570
=item C<+> Numeric Addition
572571
=item C<-> Numeric Subtraction
573572
=item C<*> Numeric Multiplication
@@ -581,6 +580,18 @@ Unchanged:
581580
=item C«== != < > <= >=» Numeric comparisons
582581
=item C<eq ne lt gt le ge> String comparisons
583582
583+
=head2 C<,> (Comma) List Separator
584+
585+
Unchanged, but note that in order to flatten an array variable to a list (in
586+
order to append or prefix more items) one should use the C<|> operator. E.g:
587+
588+
=for code
589+
my @numbers = (100, 200, 300);
590+
my @more_numbers = (500, 600, 700);
591+
my @all_numbers = [|@numbers, 400, |@more_numbers];
592+
593+
That way one can concatenate arrays.
594+
584595
=head2 C«<=> cmp» Three-way comparisons
585596
586597
In Perl 5, these operators returned -1, 0, or 1.

0 commit comments

Comments
 (0)