develooper Front page | perl.perl6.language | Postings from May 2005

Re: (1,(2,3),4)[2]

Thread Previous | Thread Next
From:
Juerd
Date:
May 11, 2005 16:22
Subject:
Re: (1,(2,3),4)[2]
Message ID:
20050511232243.GD8975@c4.convolution.nl
(reformatted to keep initialization with test)

Autrijus Tang skribis 2005-05-12  7:04 (+0800):
> 	my @a = (1,2,[3,4]);
> 	is(+@a, 3, 'Array length, nested []');

ok 1

> 	my $a = (1,2,[3,4]);
> 	is(+$a, 3, 'Array ref length, nested []');

ok 2

> 	my @b = [1,2,[3,4]];
> 	is(+@b, 1, 'Array length, nested [], outer []s');

ok 3

> 	my $b = [1,2,[3,4]];
> 	is(+$b, 3, 'Array ref length, nested [], outer []s');

ok 4

> 	my @c = (1,2,(3,4));
> 	is(+$c, 4, 'Array ref length, nested ()');

ok 5

> 	my $c = (1,2,(3,4));
> 	is(+@c, 4, 'Array length, nested ()');

ok 6

> 	my @d = [1,2,(3,4)];
> 	is(+@d, 1, 'Array length, nested (), outer []s');

ok 7

> 	my $d = [1,2,(3,4)];
> 	is(+$d, 4, 'Array ref length, nested (), outer []s');

ok 8

> Please sanity-check. :-)

All sane! :)


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About