|Pathologically Eclectic Rubbish Lister|
Syntax error with use constant and switch with comment betweenby ascetic (Novice)
|on Dec 04, 2009 at 22:36 UTC||Need Help??|
ascetic has asked for the wisdom of the Perl Monks concerning the following question:
I am at a loss to diagnose a simple syntax error caused by a conspiracy between three perl (5.8.8 on RH-Linux) features.
1) a use constant pragma which performs a division using the / character
2) a comment line with single quote and the / character (changing to double quotes behaves the same way)
3) a switch-case construct
Here is the code example
Here are the variations that I have found by trial and error that will make the code run to completion:
a) changing the HALFPI line so that NO computations use the / character
b) changing the TWOPI line so that BOTH computations use the / character
c) removing the / character from the comment line
d) removing all the ' characters from the comment line
e) delete or add ' characters at the end of the comment line so that there are an even number (example has nine)
Obviously I can get this simple pared down example to work by making minor changes, but since use constant and Switch.pm are core parts of Perl 5.8.8 (along with comment capability of course), I would like to learn from what I may have overlooked, assuming for the moment that there is not a bug in the syntax checker.Thanks in advance for what I am sure will be an interesting (and/or quick) discussion.
BTW, the error does NOT occur on my Windows machine.