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.
--
TSa (Thomas Sandlaß)