SPUG: Interesting bug using 'map'

seasprocket at gmail.com seasprocket at gmail.com
Sat Apr 11 13:26:48 PDT 2009

On Fri, Apr 10, 2009 at 12:40 PM, BenRifkah Bergsten-Buret <
mail.spammagnet at gmail.com> wrote:

>  Looking more closely I realized that the OP is doing method calls
> "$fropper->$_" instead of hash lookups "$fropper->{$_}".  A slice in this
> case would only work if you had these objects tied to a hash class that
> overloaded FETCH with a method call.  I imagine that would incur a
> performance penalty.
> The fact that these are method calls is the reason that Phil is running
> into the scalar vs. list context issue.  A hash look-up have this problem.

Ben, thanks for noticing this ... I had to do a little research to make
sense of this point. An nonexistent hash element always returns undef, but
an empty return statement returns () in list context.

Thanks to everybody who replied! I learned a bunch in this thread!!


> Ben
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
>     POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>    MEETINGS: 3rd Tuesdays
>    WEB PAGE: http://seattleperl.org/

2People citizen's network for climate action: http://www.2people.org

Greater Seattle Climate Dialogues: http://www.climatedialogues.org
The Great Warming coalition
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20090411/40b64a6f/attachment.html>

More information about the spug-list mailing list