# New Ticket Created by  Zoffix Znet 
# Please include the string:  [perl #130688]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=130688 >


When the :g adverb is used with .match, s/// or, S///, the $/ contains a list 
of match objects
for each of the matches made during matching/substitution:

    <ZoffixW> m: 'fog'.match: :g, /./; say $/
    <camelia> rakudo-moar 97359a: OUTPUT«(「f」 「o」 「g」)␤»
    <ZoffixW> m: S:g/./x/ given $ = 'fog'; say $/
    <camelia> rakudo-moar 97359a: OUTPUT«(「f」 「o」 「g」)␤»
    <ZoffixW> m: s:g/./x/ given $ = 'fog'; say $/
    <camelia> rakudo-moar 97359a: OUTPUT«(「f」 「o」 「g」)␤»

However, the .subst/.subst-mutate methods only return the last match made and 
not all of them:

    <ZoffixW> m: 'fog'.subst: :g, /./, 'x'; say $/
    <camelia> rakudo-moar 97359a: OUTPUT«「g」␤»
    <ZoffixW> m: ($ = 'fog').subst: :g, /./, 'x'; say $/
    <camelia> rakudo-moar 97359a: OUTPUT«「g」␤»

I briefly looked at the code and they seem to call match + APPLY-MATCHES just 
like S/// ops do.
No idea why the $/ ends up with just the final match.

Reply via email to