in reply to Changing XML Tag value in Perl Script
For tasks like this, I suggest using an XML manipulation package such as XML::Twig. (Or XML::Simple, although I have learned to prefer to use Twig because very few “simple” things stay that way for long.)
These packages will enable you to solve the problem swiftly:
It will surprise you how little code is actually required to accomplish this kind of task ... and to accomplish it quite thoroughly. Without a doubt, the systems that your app is talking to, are using these same core libraries and techniques, no matter what language(s) they were written in. Go and do likewise.™