I don't know what the programmatic performance would be, but using
Statistics::Descriptive
would certainly cut the amount of time you, the human,
had to spend on this problem.
Comment on Re^2: minimum, maximum and average of a list of numbers at the same time