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:
And that is the way to test it.
but then I cant work out how to get the message. I've been looking at
Zoffix's Test::Output, but not
Incomplete sentence there. I guess it doesn't work for you? Tell
us how you tried to use it, what you were expecting, and what happened