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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With