File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -528,14 +528,15 @@ it is illegal for the start position to be outside of the string, it
528
528
is allowed for the final position to be off the end of the string; in
529
529
this case the entire rest of the string is returned, whatever is available.
530
530
531
- Optionally, you can use substr on the left hand side of an assignment
532
- like so:
531
+ =item substr-rw
533
532
534
- $string ~~ /(barney)/;
535
- substr($string, $0.from, $0.to) = "fred";
533
+ multi sub substr-rw($s is rw, $from = 0; $chars = $s.chars - $from)
534
+
535
+ A version of C<substr> that returns a writable reference to a part of a
536
+ string variable:
536
537
537
- If the replacement string is longer or shorter than the matched sub-string,
538
- then the original string will be dynamically resized.
538
+ $ string ~~ /(barney)/;
539
+ substr-rw($ string, $0.from, $0.to) = "fred";
539
540
540
541
=item trim
541
542
You can’t perform that action at this time.
0 commit comments