Workshop
Quiz
1: | What were the bugs in the Listing 12.1? |
2: | If no files are given on the command line, reading <> returns
|
3: | The Perl debugger can print Perl statements as they execute. This is called trace mode. How do you put the debugger into trace mode? (Hint: You need to look at the debugger's help message for this answer.)
|
Answers
A1: | First, in line 15 the range (20..0) is not valid. The range operator—..—does not count down, only up. This line should be changed to a for($_=20; $_>-1; $_--) loop, reverse(0..20) or something similar. Second, at line 10 the $mess=s/glasses/glass/ looks like a substitution on $mess, but it's not. The substitution is actually ... |
Get SAMS Teach Yourself Perl in 24 Hours THIRD EDITION 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.