in reply to How is assigning to pos() possible?
Within a regular expression, \G, used in conjunction with the /g modifier, matches at the position in the target string where the previous match left off. pos also contains the position where the previous match ended. They are tightly related; setting pos to a number makes \G match at that position within the target string.
It has various other side-effects with respect to how m//g work, so see perlretut for a more thorough explanation.
Dave
|
|---|