# New Ticket Created by  "Dave Whipp" 
# Please include the string:  [perl #61892]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61892 >


(rakudo 34751)

I've been trying to figure out how to do a "($hd, @tl) = @list" assignments.

./perl6 -e '
    my @list = 1,2,3;
    my ($hd, @tl) = @list;
    say ([$hd], [...@tl]).perl
'
[[1], []]


That doesn't work, but it is possible by separating the declarations of "my
($hd, @tl)" to a separate statement:

./perl6 -e '
    my @list = 1,2,3;
    my ($hd, @tl);
    ($hd, @tl) = @list;
    say ([$hd], [...@tl]).perl
'
[[1], [2, 3]]


BTW, in my various experiments to get this working, I found that flattening
the rvalue "($hd, @tl) = |@list" is an error (too many args to assignment)
-- I'm not sure that that is correct. Adding parens around the flattened
rvalue does work.

Reply via email to