Slash Boxes
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.
More | Login | Reply
Loading... please wait.
  • I've always thought the obvious behavior would be to return the first element. It doesn't gain much (saves you typing two parens, maybe), but it's just what I always thought made sense...
    • Here's a short mental gauntlet for any proposal to run though:

      If sort() should do X, why not map and grep?

      Why is X useful as an implicit behavior?

      Why not use a user defined function (in this case List::Util's max/min)? (bonus: no argument about if it should return the first or last element)

      Will it help in the common "return sort ..." gotcha?

      Can you think of common cases where you want to return the entire list in list context but only do X in scalar?