Nicholas Clark wrote:
You had me thinking, "huh", for a moment before I realized why it's different. And yes, Rakudo gets the answers you expect. Added to the tests, thanks again!Yay. As does this?my @bar = 1,2,3; sub swatest { (state @foo) = @bar; my $x = @foo.perl; @foo[0]++; return $x } is swatest(), '[1, 2, 3]', 'array state initialized correctly'; is swatest(), '[1, 2, 3]', 'array state retained between calls'; [which IIRC is specified as being different]
Jonathan