Simplest would be to use a looping statement modifier.
$ perl -E ' > $str = q{abcabdaaa}; > say $str; > $str =~ s{a}{i} for 1 .. 3; > say $str;' abcabdaaa ibcibdiaa $
I hope this is helpful.
Cheers,
JohnGG
In reply to Re: how to search and replace the match with specific number of times in a string
by johngg
in thread how to search and replace the match with specific number of times in a string
by loki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |