On Wed, May 11, 2005 at 03:00:15PM -0600, Luke Palmer wrote: > On 5/11/05, Autrijus Tang <[EMAIL PROTECTED]> wrote: > > In a somewhat related topic: > > > > pugs> (1,(2,3),4)[2] > > 4 > > > > Because the invocant to .[] assumes a Singular context. > > Right, but the *inside* of the invocant is still a list, so it's in > list context. I think that line should return 3.
Okay. Here is the current (all-passing) t/data_types/nested_arrays.t:
{
my @a = (1,2,[3,4]);
my $a = (1,2,[3,4]);
my @b = [1,2,[3,4]];
my $b = [1,2,[3,4]];
my @c = (1,2,(3,4));
my $c = (1,2,(3,4));
my @d = [1,2,(3,4)];
my $d = [1,2,(3,4)];
is([EMAIL PROTECTED], 3, 'Array length, nested []');
is(+$a, 3, 'Array ref length, nested []');
is([EMAIL PROTECTED], 1, 'Array length, nested [], outer []s');
is(+$b, 3, 'Array ref length, nested [], outer []s');
is(+$c, 4, 'Array ref length, nested ()');
is([EMAIL PROTECTED], 4, 'Array length, nested ()');
is([EMAIL PROTECTED], 1, 'Array length, nested (), outer []s');
is(+$d, 4, 'Array ref length, nested (), outer []s');
}
Please sanity-check. :-)
Thanks,
/Autrijus/
pgpv0uPyXKiMu.pgp
Description: PGP signature
