in reply to Bizarreness in ?PATTERN? and g

The //g modifier is tied to pos(), which is tied to the scalar being matched against. All matches on the same scalar with the g option read and set the same pos().

The ?? is more like a flip-flop, where the counter is attached to the expression itself, so separate ?? expressions each match once, even if they use the same pattern and/or match against the same scalar.


The PerlMonk tr/// Advocate