[ Ignore ]
Perl doesn't have a destructuring assignment because it's a workaround for the inability to return multiple values that Perl has naturally.
[ a, b, ...rest ] // ES6 { a:4, b:5, ...rest } // ES6
is the same as
[ $a, $b, @rest ] # Perl { a=>4, b=>5, %rest } # Perl
Alternatively, you could argue that ... is known as ->@* and ->%* in Perl.
[ a, b, ...[ c, d ] ] // ES6 { a:4, b:5, ...{ c:6, d:7 } } // ES6
is the same as
[ $a, $b, [ $c, $d ]->@* ] # Perl { a=>4, b=>5, { c=>6, d=>7 }->%* } # Perl
Update: Changed the layout of the answer.
In reply to Re: RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl
by ikegami
in thread RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |