Using join as others have suggested can give you better control of "inter-string separation", if you know what I mean, but you can do without it (and even without the /e modifier):
c:\@Work\Perl>perl -wMstrict -le "my $s = 'int ant aunt'; print qq{'$s'}; ;; my $n = 3; $s =~ s{ (int) }{ qq{$1 } x $n }xmsge; print qq{'$s'}; ;; $s =~ s{ (ant \s+) }{$1$1}xmsg; print qq{'$s'}; " 'int ant aunt' 'int int int ant aunt' 'int int int ant ant aunt'
In reply to Re: replace a string multiple times
by AnomalousMonk
in thread replace a string multiple times
by amar712
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |