in reply to problem with removing something in XML file

Using XML::Twig, something like this (untested) should work:

use strict; use warnings; use XML::Twig; XML::Twig->new( twig_roots => { REF => sub { print $_->inner_xml; } }, twig_print_outside_roots => 1, ) ->parsefile( "my_file.xml");