Hi Yary,

in the first example you've got a WhateverCode, but in the second one
you're actually just passing a string to subst, i.e. you're evaluating
$0 before subst is even called.

Check this as well:

> raku -e '"whoa" ~~ /(.)/; say \'fosdffgg\'.subst(/(f+)/,"( $0 )", :g)'
> ( w )osd( w )gg

Hope that helps
  - Timo

On 19/04/2020 23:53, yary wrote:
> Question from today's Raku meetup. This works in a way I expect
>
> > 'fosdffgg'.subst(/f+/,"( "~ * ~" )", :g);
> ( f )osd( ff )gg
>
> This one, $0 gets the single f each time
>
> > 'fosdffgg'.subst(/(f+)/,"( $0 )", :g);

> ( f )osd( f )gg
>
> Bug or misunderstanding on my part?
>
> -y

Reply via email to