Uri, On Sun, 04 Jan 2009 22:37:43 -0500, Uri Guttman wrote:
> that fails with nested arrays. we don't want them to flatten. > > my $c = eval '(1, (4, 5), 3)'; > > will that work as you envision? No, but it's not what I'm proposing. A reference must Perlify as a reference, just as it does today, so that .perl doesn't destroy information by flattening where you don't want it to. Here's what I propose: my @a = 1, 2, 3; @a.perl.say; # (1, 2, 3) my $ra = @a; $ra.perl.say; # [1, 2, 3] my @b = 1, [2, 3], 4; @b.perl.say; # (1, [2, 3], 4) my $rb = @b; $rb.perl.say; # [1, [2, 3], 4] My objection to the current behaviour is that @a and $ra Perlify to the same string -- '[1, 2, 3]' -- losing the information that @a is an array and $ra is a reference to an array. Therefore, if you serialise and unserialise an array, you always get an array of a single element, containing a reference to the real data. What you get back is not what you put in. Markus