http://www.perlmonks.org?node_id=188746


in reply to m//g in list context

When invoked with the g modifier in list context, I thought that the return value is a list of all possible matches.

"All possible" implies matches that overlap with other matches. This isn't how regexs work. With /g, the search for the next match begins immediately after the prior match.

In your example, applying the regex   m/(\w):(\w)/g
to   "a:b:c"
matches once ("a:b"). The next search begins at ":c", which doesn't match.