in reply to syntax issue
Why can't I say: print "@${a}\n";
I don't know. You should be able to, and I can.
$ perl -wE'$a = [1,2,3]; say "@${a}";' 1 2 3
What do you get? Perhaps $a didn't contain a reference to an array when you tried it?
Also, why the curly braces surrounding the array (@{..})
In general, they're optional. In @{ $h{a} }, they override precendence.
@$h{a} => @{$h}{a} => A hash slice that expects $h to be a reference to a hash. @{ $h{a} } => @{$h}{a} => An array dereference that expects $h{a} to return an array ref.
|
|---|