in reply to Strange bug with map

That isn't a bug with map, it might be a bug with getObservations, maybe it assigns undef to  $_[0] or $_ which will affect the values

Replies are listed 'Best First'.
Re^2: Strange bug with map
by NetWallah (Canon) on Feb 11, 2016 at 00:55 UTC
    Good point.

    Most likely, the "sub getObservations{}" modifies $_ , which would upset the values in the "map" case, where he uses "$_->getObservations() ".

    In the "for" loop, he uses "$docP->" as the alias for the values, so modifying $_ inside "sub getObservations" will not change the values.

    The fix would be to "local $_" inside "sub getObservations{}" where necessary.

            "Think of how stupid the average person is, and realize half of them are stupider than that." - George Carlin