[1,2,3] is not an array or a list. It is a reference to an anonymous array. It is not 3 values; itıs 1 value, which happens to point to a list of size 3. If you assign that to an array via something like @a = [1,2,3], I would expect at least a warning and possibly a compile-time error.
If it does work, it probably gets translated into @a = ([1,2,3]), which creates an array of size 1 whose first (and only) element is a reference to an array of size 3. That would give this result: [EMAIL PROTECTED] == 1; @a[0] == [1,2,3]; @a[1] == undef; @a[0][0] == 1; @a[0][1] == 2; @a[0][2] == 3; Iım not sure about +(@a[0]), but Iım guessing it would == 3. On 2005-05-25 04:47, "TSa (Thomas Sandlaß)" <[EMAIL PROTECTED]> wrote: > Juerd wrote: >> > An array in scalar context evaluates to a reference to itself. >> > >> > A hash in scalar context evaluates to a reference to itself. >> > >> > An array in list context evaluates to a list of its elements. >> > >> > A hash in list context evaluates to a list of its elements (as pairs). >> > >> > Array context is a scalar context. > > I have understand what you mean and how you---and other p6l'er--- > derive [EMAIL PROTECTED] == 1 from @a = [1,2,3]. But allow me to regard this > as slightly inconsistent, asymmetric or some such. > > Isn't hash context missing in the list above? How does > > %a = ( a => 1, b => 2, c => 3 ) # @a = (1,2,3) > > compare with > > %b = { a => 1, b => 2, c => 3 } # @b = [1,2,3] > > Does that mean > > 3 == +%a == +%b > == +{ a => 1, b => 2, c => c } > == +( a => 1, b => 2, c => c ) > > holds and the access of the hash works as expected: > > %a<a> == 1 == %b<a> # and @a[0] == 1, but @b[0][0] == 1 > > What would actually be the equivalent syntax to @b? > Is it %b<><a> or %%b<a> or even (*%b)<a>? > It will hardly be %b{undef}<a>, though.