Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Full support (Score:2, Insightful)

    by mir (51) <xmltwig@gmail.com> on 2002.04.17 7:15 (#7158) Homepage Journal

    For the record you have my full support on the use of map in void context. I use if quite often and even find a certain pleasure knowing that it would not pass a certain guru [perlmonks.org]'s code reviews ;--).

    --
    mirod
    • Re:Full support (Score:2, Informative)

      In case anyone doesn't know and cares, map in a void context is now optimized to not return any values, so it's no longer de facto inefficient.
      • I did know, but I didn't know when it was fixed. Do you know which perl fixed that?
        • My guess is 5.6.0. But I am not sure.
          • Various people in the latest TPR golf tournament, including me, had problems related to huge memory usage caused by map() in a void context. The same programs worked fine with for(). We were using 5.6.1.

            I didn't think much about it because I didn't know the optimization was supposed to have been done. Plus we all found shorter solutions later on that didn't have the memory problem.
    • I second that as well, in fact map in void context should be compulsory in Perl code to decide whether it's any good ;)

      The only time I've been bitten by it is on one of those occasions when I threw a map in naturally, only to notice later that a for loop would have been much simpler. But that's trivial to fix...

      --

      -- Robin Berjon [berjon.com]