my $a = "13231313231313231"; say $a ~~ s:g/1/tom/; say $a ~~ s:g/2/mary/; say $a ~~ s:g/3/jane/;
有没有一个好方法一次完成所有3个步骤?
谢谢 !!!
lisprog
trans
my $a = "13231313231313231"; $a .= trans(['1','2','3'] => ['tom','mary','jane']); say $a; tomjanemaryjanetomjanetomjanemaryjanetomjanetomjanemaryjanetom
对于简单的字符串,您可以使用单词引用简化:
$a .= trans(<1 2 3> => <tom mary jane>);