(my $first, ) = (1,2,3); dd $first;
In the first example, you assign a list (or part of it) to the list of containers. Your second example does exactly what you are asking for. A list of values is assigned to one container. In Perl 5, the list is created in brackets (in this case), which results in Perl 6 creating the list with commas. The latter is used in my example to get what is required.
I would say Perl 5, which is incompatible, because sometimes lists are created with commas, brackets or parentheses.
my ($first,$,$third) = (1,2,3); dd $first, $third;
You can skip one or more list items by adding anonymous state variables. It also shortens your first example.
my $first,$ = 1,2,3; dd $first;
user5854207
source share