syntax tr///
Documentation for syntax tr///
assembled from the following types:
language documentation Operators
From Operators
(Operators) tr///
my = 'old string';~~ tr/dol/wne/;say ; # OUTPUT: «new string»
tr///
operates on the $_
topical variable and changes it in place. It behaves similar to Str.trans
called with a single Pair argument, where key is the matching part (characters dol
in the example above) and value is the replacement part (characters wne
in the example above). Accepts the same adverbs as Str.trans
. Returns the StrDistance object that measures the distance between original value and the resultant string.
my = 'old string';~~ tr:c:d/dol st//;say ; # OUTPUT: «ring»