Front page | perl.perl6.language |
Postings from May 2005
Re: (1,(2,3),4)[2]
Thread Previous
|
Thread Next
From:
Thomas.Sandlass
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