4.8.3 The m//g Modifier
4.8.3 The m//g Modifier
Usually, when Perl performs a match operation, the pattern matches only once on the target string. The regular expression matches in the position in the target string where the expression is satisfied the first time. It is possible that the regular expression matches in several positions in the target string. In such situations, all but the first occurrence are ignored. However, it is possible to force Perl to match all occurrences of a regular expression in the target string. This modification of Perl’s pattern matching behavior can be effected using the g modifier.
