On Mon, May 19, 2003 at 11:06:46PM +0200, Rafael Garcia-Suarez wrote: > Michael Fowler reported a weird parsing bug (#22231) caused by the > presence of the Switch module in a program, and of a comment > containing the word "switch". I replied to this bug on bugs.perl.org (because I'd deleted the original report), but my reply hasn't shown up on p5p, and bugs.perl.org isn't showing my attachment, so I'll try again through email... The parsing error is introduced by the following section of code in Switch.pm: @pos = Text::Balanced::_match_variable(\$source,qr/\s*/); if (defined $pos[0]) { $text .= " " . substr($source,$pos[0],$pos[4]-$pos[0]); next component; } As you can see, when matching a variable, the filter adds a space to the text, even if no space was present in the original source. Thus, <$foo> becomes < $foo>, which perl interprets as glob(' ' . $foo) instead of readline($foo). (Also note that Switch uses private methods of Text::Balanced. Tsk tsk!) This patch should fix the behavior, by making the filter add a space character to the text iff the original source has one or more whitespace characters there. I made the same change everywhere a space was being added after using a Text::Balanced method. RonaldThread Next