The following code:

use v6;

my $str = 'abc';

sub s {1};
say s;

$str ~~ s:g/ b /x/;
dd $str;
say $/;

outputs:

1
Str $str = "axc"
(「b」)

as expected.

But, just remove the :g global flag and:

===SORRY!=== Error while compiling /home/hogaboom/hogaboom/Perl6/p6ex/./t.p6
Undeclared routine:
    b used at line 10

results.

Is the sub name s() interfering with the s/// somehow, but s:g/// does not?


rahogaboom

Reply via email to