|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Re: "While" effect on regex?by roboticus (Canon) |
| on Feb 17, 2013 at 00:01 UTC ( #1019085=note: print w/ replies, xml ) | Need Help?? |
|
Without the 'g' modifier, the m/.../ operator simply reports whether the string matches or not. Unless you change the string, it will *always* match or *always* fail. If you read perlre, it'll refer you to perlretut. In there it says:
The relevent bit is the italicized bit. It's telling you that with the g operator, the match remembers where it left off, and the next time you match with the g operator, it will proceed from that point. Long story short: that's what the 'g' modifier does! ...roboticus When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||