Loginskip to content

Archive for the 'perl' Category

At this point, we’re going to go on

Monday, October 30th, 2006

At this point, we’re going to go on a tour of typo examples with different diagnoses. 8.2.1 Quotable Quotes Our first program sets up a hash %quotation indexed by author and then goes on: while (my ($author, $quote) = each %quotation) { print ‘Quote of the Day: “$quote” by $authorn’; } This runs, but takes us too literally: Quote of the Day: “$quote” by $authornQuote of the Day: “$quote” by $authornQuote of the Day: “$quote” by $authorn… Aha! Nothing is being interpolated because we’re using single quotes. We change them to double quotes: 3 while (my ($author, $quote) = each %quotation) 4 { 5 print “Quote of the Day: “$quote” by $authorn”; 6 } Yikes, now we get three errors: Scalar found where operator expected at typo.pl line 4, near “”Quote of the Day: “$quote” (Missing operator before $quote?) syntax error at typo.pl line 4, near “”Quote of the Day: “$quote” String found where operator expected at typo.pl line 4, near “$quote” by $authorn”" (Missing operator before ” by $authorn”?) Execution of typo.pl aborted due to compilation errors. Once again, we consider only the first message. Whenever Perl provides a hint after the error, read it carefully. Perl suggests that we omitted an operator before $quote, but why would it expect an operator in the middle of a string? Aha we must not be in a string any more. At this point I would have pointed out that the syntax coloring feature of Emacs cperl mode would have shown this, but I promised Ed not to make fractious text editor advertisements.
Note: If you are looking for cheapest and affordable webspace to host and run your servlet application check Astra servlet hosting services

line 2) (Do you need to predeclare print?)

Sunday, October 29th, 2006

line 2) (Do you need to predeclare print?)

Sunday, October 29th, 2006

use strict $message = “Hello World”; print “$messagen”;

Sunday, October 29th, 2006

use strict $message = “Hello World”; print “$messagen”;

Sunday, October 29th, 2006

written by people obsessed with minimizing typing: we

Sunday, October 29th, 2006

written by people obsessed with minimizing typing: we

Sunday, October 29th, 2006

Chapter 8. Syntax Errors “Fire bad!” Frankenstein’s monster

Sunday, October 29th, 2006

Chapter 8. Syntax Errors “Fire bad!” Frankenstein’s monster

Sunday, October 29th, 2006

7.3.2 ptkdb ptkdb, developed by Andrew E. Page,

Sunday, October 29th, 2006