I usually treat or as lower precedence than anything -- I use it almost exclusively as do_something() or die "Help!" After going through the perlop and perlsyn man pages, I think I see now: the ors are part of the expression that follows the while modifier, not part of the full expression.push @elements, $1 while /\G\s*"(.*?)"/gc || /\G\s*'(.*?)'/gc || /\G\s*(\S+)/gc;
Sooo.... In this case, the || works like the or. You could make an "or die" type of thing by parenthesizing the while expression:
Although this is stupid since the while will return a false value at some point (you hope!), so you'll always die. But if you changed it to an and, you could detect if the loop never executed. (Hmmm... Potentially useful trick.)push @elements, $1 while (/\G\s*"(.*?)"/gc or /\G\s*'(.*?)'/gc or /\G\s*(\S+)/gc) or die "Argh";
In reply to Re: Extract potentially quoted words
by VSarkiss
in thread Extract potentially quoted words
by merlyn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |