Hi, Autrijus Tang wrote: > my ($x, @a); > $x := @a[0]; > @a := ($x, $x, $x); > $x := 1; > say @a; # (undef, undef, undef)
hm, I'd expect @a to be (1, 1, 1) (WE = when evaluated): my ($x, @a); # $x is undef WE, @a is () WE $x := @a[0]; # $x is undef WE, @a is () WE @a := ($x, $x, $x); # $x is undef WE, @a is (undef, undef, undef) WE # But those "undef"s are bound to @a[0] -- # @a := (@a[0], @a[0], @a[0]); $x := 1; # $x is 1 WE, @a[0] is 1 WE say @a; # (1, 1, 1) And: my ($x, @a); # $x is undef WE, @a is () WE $x := @a[0]; # $x is undef WE, @a is () WE @a = ($x, $x, $x); # $x is undef WE, @a is (undef, undef, undef) WE # Those "undef"s are real undefs $x := 1; # $x is 1 WE, @a[0] is 1 WE say @a; # (1, undef, undef) Opinions? --Ingo -- Linux, the choice of a GNU | To understand recursion, you must first generation on a dual AMD | understand recursion. Athlon! |