http://www.perlmonks.org?node_id=507350

I'm not a perl expert... infact i'm not able to really understand the code of List::Util maybe you can clarify to me about this question: Do your code process three times the input list?
• Comment on Re^2: minimum, maximum and average of a list of numbers at the same time

Replies are listed 'Best First'.
Re^3: minimum, maximum and average of a list of numbers at the same time
by broquaint (Abbot) on Nov 10, 2005 at 12:41 UTC
Do your code process three times the input list?
Indeed it does and as davorg and demerphq have pointed out in their replies it isn't terribly efficient, but that's a "perlish" solution for you.
HTH

_________
broquaint

Re^3: minimum, maximum and average of a list of numbers at the same time
by blazar (Canon) on Nov 10, 2005 at 14:36 UTC

But you're not required to understand it. But then of course without even having seen it I'm sure it does process it three times. If that is really relevant, then indeed you may want or have to process it once yourself. And if it is very relevant, perhaps you may want to do it as a binary extension.

Well, the author may consider a adding to List::Util a function to calculate more than one relevant quantity at a time, e.g.

```my (\$min, \$max, \$sum) = calculate [qw/min max sum/], @list;
```my \$stats=List::Util->calculate([qw/min max sum/])->of(@list);
```calculate [qw/min max sum/], @list;