# New Ticket Created by Patrick Abi Salloum # Please include the string: [perl #77302] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=77302 >
sub foo { my @a = (1,2,3,4,5); gather { my $val ; while @a { $val = @a.shift(); take $val; } } }; say foo().join('') ; #outputs 55555 say foo(); #outputs 12345 Moving the my $val to inside the while produces 12345 in both cases <patrickas> rakudo: sub foo {my @a = (1,2,3,4,5);my $val ;gather {while @a {$val = @a.shift();take $val;}}};say ~( foo() ) ; say foo(); <+p6eval> rakudo 037f68: OUTPUT«5 5 5 5 5⠤12345⠤» <patrickas> is that ^^ a known bug ?? Is it a bug at all ? <TimToady> not a bug, really <TimToady> put the my inside the while loop <TimToady> you've just taken five refs to the same var <TimToady> though, perhaps a bug, nonetheless <TimToady> since take is supposed to de-containerize like return