# New Ticket Created by "Mark E. Shoulson" # Please include the string: [perl #103332] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=103332 >
Variables seem to wind up with the wrong values inside loops in recursive functions. Code: my $counter=0;sub recur(Int $x) { my $h; $h="h" ~ $counter; $counter++; my @k=(1,6); if ($x>0) { recur($x-1); } for @k { say $_ ~ " and h is $h"; } say "h is $h";}recur(3);====== Results: Expected output, and received from earlier perl6 (This is Rakudo Perl 6, version 2011.06 built on parrot 3.5.0 RELEASE_3_5_0): 1 and h is h3 6 and h is h3 h is h3 1 and h is h2 6 and h is h2 h is h2 1 and h is h1 6 and h is h1 h is h1 1 and h is h0 6 and h is h0 h is h0 Output received from later rakudo (This is perl6 version 2011.10-98-g1985138 built on parrot 3.9.0 revision RELEASE_3_9_0-51-g65e6ab7): 1 and h is h3 6 and h is h3 h is h3 1 and h is h3 6 and h is h3 h is h2 1 and h is h3 6 and h is h3 h is h1 1 and h is h3 6 and h is h3 h is h0 ====== ~mark