I can't find a way to translate using trans
a single quote to a escaped single quote:
say ($ = "'well done'").=trans("'" => "\\\'" ) ;# OUTPUT: «\well done\»
say ($ = "'well done'").=trans(<'> => Q [\'] ) ;# OUTPUT: «\well done\»
say ($ = "'well done'").=trans("'" => q"\\\'" );# OUTPUT: «\well done\»
There's probably a workaround using split or any number of other things, including subst
. In principle, the first one actually produces \'
, which is what I've been looking for. Maybe doubling up the scapes will help?
subst
instead – Pricefixing