One must be careful with the ${\foo} because if foo returns something that isn't a simple scalar value then you might get unexpected results.
To be more precise, the \ operator gives its argument list context, which may surprise many people (it did me). The other interpolation construct @{[ ]} also provides list context. This is something to be aware of, and use of scalar will be appropriate in some cases, including in ${\scalar foo}.
Abigail
In reply to Re: Perl Idioms Explained - ${\$obj->method} and @{[sort @list]}
by Abigail-II
in thread Perl Idioms Explained - ${\$obj->method} and @{[sort @list]}
by broquaint
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |