my $xml = XML::Twig->new()->parsefile('example.xml') ; $xml-> ... ; $xml -> get_xpath('//ipaddress',0) -> set_text("") ;