In Perl, you can have a link (pointer) to a data structure:
When you have a link, to be able to use an array, you need to dereference it
@{ $ref }
If you need to access an element, as in
$array[0]
you can do the same with reference
${$ref}[0]
braces {} are optional and you can also use
$$ref[0] @$ref
but I personally find them less readable.
The same applies to all other types (like %$ for a hash link).
See man perlref and man perlreftut for a tutorial for more details.
Edit
The arrow operator -> can also be used to dereference an array or hash
$array_ref->[0]
or
$hash_ref->{key}
See man perlop for more details.
source share