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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.