in reply to editing xml using perl

I couldn't be bothered to read your node because you couldn't be bothered to read the formatting advice so in answer to your title: use XML::Twig.

True laziness is hard work