SPUG: Interesting bug using 'map'

Tye McQueen tyemq at cpan.org
Thu Apr 9 22:19:21 PDT 2009


On Thu, Apr 9, 2009 at 8:52 PM, <seasprocket at gmail.com> wrote:

> map evaluates BLOCK in LIST context



> But that's ugly -- is there a cleaner way to avoid this problem?
>

... map { scalar( ... ) } ...

There are also lots of other ways to get scalar context.  Speaking of bugs,
I consider the fact that the following doesn't fix the problem (at least not
in all versions of Perl) to be a Perl bug :)

... map { ( ... )[0] } ...

Tye
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20090409/96053d2c/attachment.html>


More information about the spug-list mailing list