That is how the g modifier works in scalar context. The match doesn't fail in the first or second attempt nor do you use reset so pos() is not reset and the next pattern will match where the last one left off. Read the entire section of perlop that deals with m/PATTERN/cgimosx & /PATTERN/cgimosx because it explains it very clearly.
In reply to Re^5: Bizarreness in ?PATTERN? and g
by Mr. Muskrat
in thread Bizarreness in ?PATTERN? and g
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |