Exercise: Statistics

Now that you've learned about functions, you should begin to see the benefits of encapsulating code in self-contained functions. Functions provide code that can be easily reused. In this exercise, three functions provide some analysis on groups of numbers.

Just to refresh your memory from school, the mean—also called an arithmetic mean—of a group of numbers is simply the average of all the numbers. The median is the number in the middle if you were to sort the group numerically. With an even number of elements, the median is the average of the two numbers in the middle. The standard deviation gives an idea of how "bunched" the numbers are around the mean. A high standard deviation means the numbers are widely distributed; ...

Get Sams Teach Yourself Perl in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.