in reply to Switch - "case" may clash with future reserved word

That's exactly the message I get when I don't use use Switch; Switch doesn't detect your code as being a switch statement, probably due to something elsewhere in the program. Source filters are fragile.

Remove bits of the program until perl -c script.pl no longer gives the error. The last bit of code you removed likely contains the code Switch has a problem with.

I know that some functions of Text::Balanced (used by many source filters including Switch) have problems with //, although I don't know if it'll result in this problem, though. split(//, $var, -1) can be replaced with $var =~ /(.)/sg.

Replies are listed 'Best First'.
Re^2: Switch - "case" may clash with future reserved word
by Fletch (Bishop) on Nov 28, 2007 at 21:59 UTC

    I've seen other brittleness with it interpreting random "s"s in text when trying to parse for quotelike strings. Apparently it gets to thinking thinking it's the start of some form of a s/// statement and gets massively confuzzled with the crashing and the syntax errors and the GLEIVEN!

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.