written by people obsessed with minimizing typing: we recommend that you insert a semicolon after every statement, even at the end of a block, since you never know when you might come back later and insert another statement after it.) $message = “Hello World”; print “$messagen” exit; Perl responds with syntax error at line 3, next token “exit” The Perl compiler, like every other compiler we know, often goes somewhat further in your program than the actual error before reporting a problem. Since we’ve never met a compiler that indicated an error for a line number preceding the first one containing an error, we can use Perl’s report of the line number as an upper bound and work backwards from it. The actual syntax error in your program could occur not just on the line reported by Perl, but on any line preceding it. In this case, the line it reported was the last line of the file anyway (which often happens), but them’s the breaks. The strategy for fixing this problem: “syntax error” tells you that Perl has determined the problem to be a straightforward typo (count your blessings), so you know what you’re looking for something that doesn’t look like valid Perl, on or before line 3. Perl gives us an additional piece of information, that the next token is exit. If we’re lucky, that means that the error occurred immediately before that word, so that’s where we start looking. Immediately, we notice a missing semicolon on line 2. Success! Problem located and identified. Case closed. (No, there’s no substitute for looking over the code with a Mark I eyeball. However, if you have reams of code to search, you can reduce the amount you have to check by removing or commenting out parts of it selectively until you see the error message change.) Now let’s consider another missing semicolon that’s far more insidious: use strict my $message = “Hello Worldn”; print $message; exit; This program compiles fine; it even runs without error. Unfortunately, it also runs without output. What happened to the contents of $message? A long or a short way can be used to debug this problem. Let’s try the long way first (the reason for this choice will become apparent in due course). We’ll fire up the debugger (see Chapter 7). The first (meaningful) output from the debugger is
Note: If you are looking for reliable and quality webspace company to host and run your servlet application check Actions servlet hosting services