Author: Florian KaufmannFlorian Kaufmann
Date: Dec 12, 2007 01:55
Hello
I am still after the answer to the old question whats the difference
between an array and a list. Yes, I read the faq, and I am reading
Programming Perl.
In my current understanding, the array subscript operator [] forces
its left operand to be an array. Thus, if that left operand is a list,
that list is converted to an array. Thus things like
$x = (1,2,3)[0];
$x = (3)[0];
work. But then again, why shoudn't that work?
$x = 3[0];
I thought it's the operator , which composes/constructs a list, not
parantheses. Parantheses are in this discussion only used for
overwriting precedence. Eg this works to create an array with just one
element
@a = 3;
I don't have to write
@a = (3);
|