June 2005
Beginner
480 pages
10h 31m
English
This exercise shows you how to use the debugger. The program in Listing 12.1 has a problem—actually two. It's supposed to print these messages:
20 glasses of Lemonade on the wall 19 glasses of Lemonade on the wall : 1 glass of Lemonade on the wall 0 glasses of Lemonade on the wall
But it does not. Your task is to type the program in Listing 12.1 and try to find the bugs. Neither of the bugs is a syntax problem—Perl's warnings are not triggered, and use strict prints no messages—but the debugger should make the bugs fairly obvious to find.
After you type the program, run Perl with the debugger to try to find the errors. Remember to print relevant variables and expressions occasionally and step through the function calls ...
Read now
Unlock full access