Expressions that are list elements are no exception. The list operator decides the context of its operands based on its context:
@a = (1,2,3,4); # list, list, list, list
$a = (1,2,3,4); # void, void, void, scalar
Your second example does not have any "list elements" because you can't have a list in scalar context.
In reply to Re^3: Scalar Vs. List context
by jwkrahn
in thread Scalar Vs. List context
by biohisham
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |