in reply to Help Debug!

Okay, I went through and did some debugging. I'm running in 5.005_03, like you, so I got the same error. I stepped through the code using print statements, and it looks like the error is basically that, in, when the filter is running over the program source, it can't find any case statements.

Which means that the source isn't getting filtered properly, and so the filtered source ends up with the same case statements that are in your original source--but case isn't a valid Perl bareword, so that's why you get that error.

But that's simply the symptom, really.

The *real* problem is this: Text::Balanced::_match_quotelike is being called, and it matches from the first '?' to the last (the one in the comment), and it sees that as a valid regex. In case this doesn't quite make sense, it sees this:

? 'foo' : 'bar'; switch('x'){ case 'y' {print "y\n"} else {print "x\n"} } # ?
Question marks ('?') are valid regex delimiters; valid in the sense that you don't need a 'm' in front of them. They're like '/'. You can just say:
if ($foo =~ ?bar?)
That's legal.

Here's a runthrough of what's going on, essentially; it makes the most sense if you follow along in the original source.

So this is my theory/observation on what's happening. I haven't checked yet on 5.6 to see why it's working there; I really have no idea why.

But it seems to fit pretty well.

UPDATE: I just tested this on Perl 5.6.0, and I got errors there, as well. So it looks like it's matching in 5.6.0 as a '?'-delimited regex as well. The error is slighty different:

syntax error at line 9, near "){" String found where operator expected at line 10, near "case 'y'" (Do you need to predeclare case?) Execution of aborted due to compilation errors.
But it's certainly the same idea: it doesn't understand what either switch or case is, which means that they didn't get filtered properly. And stepping through using the same debugging statements shows me that it's matching the same things in 5.005_03 as in 5.6.0.