Replacing XML tag values
First and foremost, XML is not a regular language, and therefore parsing it using regular expressions is not appropriate, and is asking for trouble. 

Secondly, invoking perl within perl is clearly an awful idea. Invoking it multiple times is even worse.

As all the s!!! operations are performed on the same file, you could perform all of them at once in the same process, by separating them with semicolons, that is:

perl -pi -e 's!pattern1!replacement1!sg; s!pattern2!replacement2!sg' file


But as I said earlier, you should not call perl from within a perl function in a backtick expansion, but implement properly the operations (open file, read buffer, perform replacements, overwrite the file).

And instead of doing this using regular expressions, consider using an XML parser.