# New Ticket Created by Daniel Green
# Please include the string: [perl #75002]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=75002 >
I was testing rakudo out on a project euler problem and noticed some
odd behavior in multi-dimensional arrays. I modified the array in a
loop, but when that loop was finished and I printed the array in
another loop it had incorrect values. Below is some code that
demonstrates the behavior. @d[0..3;1] should be 3,5,7,9, but instead
they're all 9. This was tested on the trunk, current as of a couple
hours ago.
Daniel Green
#/usr/bin/perl6
use v6;
my @d[4;4];
for 0..3 -> $x {
@d[$x;0] = 1;
my $s = 2 * ($x + 1);
print "\$x=$x, \$s=$s, \...@d[\$x;0...@d[$x;0], \$s + \...@d[\$x;0]=" ~
$s + @d[$x;0];
@d[$x;1] = $s + @d[$x;0];
say ", \...@d[\$x;1...@d[$x;1]";
}
print "\n";
for 0..3 -> $x {
for 0..3 -> $y {
say "\$x=$x, \$y=$y, \...@d[\$x;\$...@d[$x;$y]";
}
}