in reply to Modify XML

XML::Twig
use warnings; use strict; use XML::Twig; my $xmlstr = '<XML> <TestElement>Hello</TestElement> </XML>'; my $twig = XML::Twig->new(twig_handlers => {'XML/TestElement' => sub { +$_->set_text('Bye')} }); $twig->parse($xmlstr); $twig->print(); __END__ <XML> <TestElement>Bye</TestElement> </XML>

Replies are listed 'Best First'.
Re^2: Modify XML
by perl@1983 (Sexton) on Apr 04, 2011 at 17:13 UTC
    Hi toolic, Thanks for the solution. Will try this as well.