As long as List::Util is being brought into play, why not use sum() as well as min() and max()? Just push entries to an array, say @numbers, as long as conditions for continued entry are met, then, after a test for no numbers at all having been entered,
print 'The average of the numbers was ', sum(@numbers) / @numbers;
print 'The largest number was ', max @numbers;
print 'The smallest number was ', min @numbers;
(Admittedly, this approach may not be appropriate for homework.)
In reply to Re^2: I am stuck on how to print the largest and smallest numbers from user inputted values. Any help is appreciated.
by AnomalousMonk
in thread I am stuck on how to print the largest and smallest numbers from user inputted values. Any help is appreciated.
by pcoady
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |