August 2009 Archives

Fri Aug 7 10:13:45 EDT 2009

OSX Perl contains broken switch

Arrgh!!! Ok, I've just written a nice perl routine for parsing some data files. I'm using a switch statement liberally as there are many kinds of data in each log file. And I've been stumped with syntax errors that make no sense. Here’s an example:

./dataparser.pl
Number found where operator expected at ./dataparser.pl line 79, near "case 1"
    (Do you need to predeclare case?)
String found where operator expected at ./dataparser.pl line 80, near "case "a""
    (Do you need to predeclare case?)
syntax error at ./dataparser.pl line 78, near ") {"
syntax error at ./dataparser.pl line 80, near "case "a""
syntax error at ./dataparser.pl line 81, near "case ["
syntax error at ./dataparser.pl line 82, near ")   {"
Execution of ./dataparser.pl aborted due to compilation errors.

In an act of desperation I Googled around and found this thread. The exact problem is discussed. It was fixed in 2004. WTF. How is it not fixed in Perl 5.8.8? What a pain. Sorry for the rant.


Posted by vschmidt | Permanent link | File under: mac, perl