in reply to Regexp oddity

My thanks to everyone who wrote back on this--I finally figured it out.

$OPand was set to '\s+', as this was how the input string is set. This is also why I was using \s*?, believing it would capture any whitespace in the case of the $OPor or $OPnot separators. However, perl was evaluating "blah, blah2" and returning $1 = 'blah,', $2 = ' ', and $3 = 'blah2'. The reason I erroneously assumed the regexp was destroying 'blah2' is the script loops, evaluating $1 as the test string. The handler for ($2 =~ /^\s+$/) was written incorrectly, so the script just skipped over the first iteration. It worked on the second iteration, however, evaluating "blah,", and thus finding $1 = "blah", $2 = ",", and $3 = "".

Again, thanks for the pointers--they definitely helped me figure out what I'd done incorrectly.