Ok, There's one thing that is not clear in the thread, which is when an
array is multidimensional or not...

For instance:

 @a = (1, 2, 3; 4, 5, 6; 7, 8, 9);

Will produce a flatten array, because list assignment causes flattening,
so the dimensionality was lost.

It is important to remember that this was a change in the spec that
happened some time ago. Before that, @a and @@a did refer to the same
variable, but this is no longer the case. Now @a and @@a are different
variables (in fact the @@ sigil is probably going to be replaced, since
it's not just "list slice" but it's actually a capture)

So, in the @a = (1,(2,(3,4)); example, @a will be a flat list with 4

So, how do I deal with a multidim array? Well, TIMTOWTDI...

 my @a = 1,[2,[3,4]];
 say @a[1][1][1];
 say @a[1;1;1]; # I'm not sure this is correct

Or.. (I'm using the proposed capture sigil here, which has '@%a' as its
expanded form)

 my ¢a = 1,(2,(3,4);
 say ¢a[1][1][1];
 say ¢a[1;1;1];

I think that makes the semantics of the API more clear...


Reply via email to