On Sun, Jun 22, 2008 at 2:59 PM, Frederik Schwarzer <[EMAIL PROTECTED]> wrote: > Hi, > > there is something I do not understand. > I reduced the code to a minimal case. > > If I do: > my $a = 23; > my $b = $a; # copy > $a = 42; > say $b; # 23 > $b is 23, > and if I do: > my $a = 23; > my $b := $a; # reference > $a = 42; > say $b; # 42 > $b is 42 because it is just a reference to $a. > > But if I do: > my @arr = (23, 42); > my $temp = @arr[0]; # copy? > @arr[0] = @arr[1]; > say $temp; # 42 > $temp is 42 ... > I expected $temp to be 23 here. > > Am I missing something? > > Regards, > Frederik >
Which implementation of Perl 6 are you using here? In Rakudo, everything works as you describe except for the last example which dies on the last line with: Scope not found for PAST::Var '$temp' current instr.: 'parrot;PCT::HLLCompiler;panic' pc 156 (src/PCT/HLLCompiler.pir:103) -- Will "Coke" Coleda