Firstly, @$ref[0]
is different from \@$ref[0]
. You have the first in a debugging session, and the second in a script.
In any case, @$ref[0]
means the same as @{$ref}[0]
. If you have an array named @ref
, @ref[0]
will be equivalent. It uses slice notation to get the first element of an array.
The difference between @array[$x]
and $array[$x]
is that in the first you can specify more than one index and return a set of elements from the array, and not just one. But if you only put one index between the brackets, you will get the same result.
source share