Perl syntax in relation to references

perl

Solution

This means dereference an array ref.

You will see the content of the referenced array.

Note that you could use the simple

@$x

in your case.

The `{ }` characters are needed when you have multiple levels in your data structure like in this example :

@{ $foo->{first_level}->{second_level} }

or

@{ $foo->[$first_level]->[$second_level] }

This works too with others sigils :

%{ } # HASH
$    # SCALAR

See `perldoc perlreftut`

Problem

Consider x is an array reference. I know that `[]` gives an anonymous array reference and `{}` gives an anonymous hash reference. Now what does `@{$x}` mean?

Original source