[to you only, as this thread is now distinctly off-topic for perl6-language]
Buddha Buck wrote:
>
> @array1 = (1, 1, 3, 5, 8, 13);
> %hash1 = ('foo', 34, 'bar', "not a number", 'baz', 4);
> @array2 = %hash1;
> %hash2 = @array1;
>
> This works, and may lead to confusion because:
This is exactly what I was referring to in an earlier post --
that the well-definedness of these assignment operations leads
the unsuspecting to believe that there really is some kind of
equivalence of the underlying structures, when in fact there
is not.
> Reading that, what would you say the difference between an array, a list,
> and a hash is?
>
> (My answer: From that glossary, I'd say that 'array' and 'list' are
> virtually synonymous. From actual use, I'd say that an array can be an
> lvalue, but a list is strictly an rvalue.)
( $a, $b, $c ) = ( 1..100 );
No, lists can be lvalues too.
The difference, as stated before, is that LISTs are not variables; that
is, a list has no unified internal data structure, upon which such
operations as push() or each() might work. Some people like to say that
a list is just a bunch of scalar values on the stack; but if you don't
think in terms of call stacks, that analogy doesn't illuminate.
I like to think of variables (scalars, arrays, and hashes) as being
Perl's intrinsic object types; each supports a set of methods: array
supports the push() method, hash supports the each() method, etc.
Thinking of it in these object-oriented terms, I can say that a LIST
is not an object, and so does not support any object methods.
There are some things you *can* do with a list, such as index into it
to get specific elements; but this is merely a syntactic convenience
for the programmer, and has little to do with indexing into a true
array variable.
Hope this helps,
--
John Porter