in reply to On the rejected additions to List::Util

because I need to average of a list of numbers and it is not in this API

It kinda is. sum(@list)/@list.

Replies are listed 'Best First'.
Re^2: On the rejected additions to List::Util
by metaperl (Curate) on Apr 29, 2009 at 16:58 UTC
    That is not very DWIM. I take engineering software seriously. And aim for readability and conciseness. DWIM supports that greatly.
      How do you average numbers when you don't have a computer? I can't think of a more readable and DWIM-my way of writing something than by expressing the very definition of how it'd be done by hand.

      Kids learn the average is the sum divided by the count at a young age, so it's definitely readable.

      As for conciseness, sum(@list)/@list is really not that far off from avg(@list)

      Nothing is stopping you from putting that expression in a sub if you think it's not readable or concise enough.