May 2002
Beginner
704 pages
16h 37m
English
Let's modify the stats example once more in this lesson to take advantage of just about everything you've learned so far in this book. I've modified stats such that instead of reading the values, printing everything, and then exiting, the script prints a menu of operations. You have a choice of the sort of operations you want to perform on the numbers in the data set.
Unlike the names.pl script from Day 8, however, which used a large while loop and a number of if tests to handle the menu, this one uses subroutines. In addition, it moves a lot of the calculations we performed in earlier versions of this script into the subroutine that actually uses those calculations, so that only the work that needs to be done ...