DB<1> @a= qw/zero one two three four/ DB<2> $pi ='three . one four one' DB<3> $pi =~ s/$a[$_]/$_/ig for 0..4 DB<4> p $pi 3 . 1 4 1 DB<5>
Please note that replacing all the "one" before replacing "two" might change the input in unexpected ways.
It really depends if you are really replacing numbers ...
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re: Combining multiple =~ s/
by LanX
in thread Combining multiple =~ s/
by hennesse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |