If the intent was to capture all of the matches, then you'd have to 1) capture them, which would involve, 2) using that construct in a list context.
As it is used, it is in a scalar (Boolean) context which means that whether there is one match or 20 doesn't make a difference and so the /g modifier doesn't add any value. That is why the /g modifier in a scalar context does something different. It just returns the next match.
Now if you replace if with while, then the /g would make sense as a way to have the body of the while loop deal with (the text captured by the parens) one match at a time.
If you have more questions on this, please at least include more code. (:
- tye (but my friends call me "Tye")In reply to (tye)Re2: Upgrading to new perl environment
by tye
in thread Upgrading to new perl environment
by skeeterpop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |