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

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

Thread Previous | Thread Next
From:
=?ISO-8859-1?Q?=22TSa_=28Thomas_Sandla=DF=29=22?=
Date:
May 18, 2005 12:54
Subject:
Re: (1,(2,3),4)[2]
Message ID:
428B9D69.70200@orthogon.com
Juerd wrote:
>>	my @b = [1,2,[3,4]];
>>	is(+@b, 1, 'Array length, nested [], outer []s');

Isn't that a bit inconvenient? To get e.g. 2 out of @b
one has to write @b[0][1] while for $b a $b[1] suffices.
And @x = @b maintains this superficial level of indirection?
Does @x = @b[] remove one level? How does that compare
to @x[] = @b?

Thus

my @b = (1,2,[3,4]);

is equivalent to

my $b = [1,2,[3,4]];

which in turn is equivalent to

my $b = (1,2,[3,4]);

and

$b = @b

blows away one level of indirection? Or is it then $b[0][1] == 2 as well?

In the end the LHS is needed to calculate +[1,2,[3,4]] == 1|3?
The same applies to testcases 7 and 8.


> All sane! :)

Am I insane?
-- 
TSa (Thomas SandlaƟ)


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