in reply to Perl Idioms Explained - ${\$obj->method} and @{[sort @list]}
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Perl Idioms Explained - ${\$obj->method} and @{[sort @list]}
by bradb (Sexton) on Aug 23, 2003 at 19:24 UTC | |
by adrianh (Chancellor) on Aug 24, 2003 at 11:31 UTC | |
by bradb (Sexton) on Aug 25, 2003 at 00:42 UTC | |
by adrianh (Chancellor) on Aug 25, 2003 at 23:58 UTC | |
by Aristotle (Chancellor) on Aug 24, 2003 at 07:31 UTC |
In Section
Meditations