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
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
the "obvious" unexciting thing (Score:1)
rjbs
Reply to This
Re:the "obvious" unexciting thing (Score:1)
rjbs
Re:the "obvious" unexciting thing (Score:2)
Both would have their uses.
Re:the "obvious" unexciting thing (Score:1)
rjbs
Re:the "obvious" unexciting thing (Score:2)
Except that it's bound to be used as a shortcut for min() or max() (I've seen people write (sort @list)[-1]), which is rather inefficient compared to using List::Util (now in the core) or rolling you own min() or max().
Code examples [mongueurs.net] and benchmarks [mongueurs.net] available there, in French (sorry).
Re:the "obvious" unexciting thing (Score:2)
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
Can you think of common cases where you want to return the entire list in list context but only do X in scalar?