in reply to Re^2: Complicated search and replace on a string
in thread Complicated search and replace on a string

In the Perl environment, you should always look for a CPAN module first.   Q: “What is all the Perl-language fuss about?”   A: “CPAN!”

Modules – thousands of them – to do just about anything imaginable.   All installed on your system, and self-tested on your system, in a matter of seconds.   It is almost never the right thing to do, to “roll your own.”   Leverage CPAN heavily.