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


in reply to Re^2: minimum, maximum and average of a list of numbers at the same time
in thread minimum, maximum and average of a list of numbers at the same time

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;

or perhaps with an OO interface:

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

possibly even with a mixed interface:

calculate [qw/min max sum/], @list; print List::Util::lastrun->max, "\n";