On 6/8/2015 2:46 PM, Paul Cochrane wrote:
substr has a 4th argument (or you can use substr as an lvalue) for
From http://doc.perl6.org/routine/substr I don't see any way to do a
replacement. What is the idiomatic way of doing a positional string
replacement in Perl 6? Thanks!
I believe `substr-rw` is what you're looking for:
my $s = "The black cat climbed the green tree";
The black cat climbed the green tree
my $z = substr-rw($s, 14, 7) = "jumped from";
The black cat jumped from the green tree
As far as I know, not all of its behaviour has been implemented yet (FWIW it
looks like it shouldn't have returned "jumped" above; my guess is that it
should have been "climbed". Nevertheless, it seems to do that which you're
Hope that helps!