in reply to accessing multiple items from array
@array[EXPR] is a slice. EXPR will be evaluated in list context, resulting in a mulitple number, resulting in mulitple elements being returned.
$array[EXPR] is just simple indexing and not a slice. EXPR will be evaluated in scalar context, resulting in a single number, resulting in a single element being returned.
Note that in scalar context, the comma is the comma operator, a binary operator that evaluates both operands and returns the right operand. That means that 1,3 returns 3 in scalar context.
|
|---|