use strict; use warnings; use XML::Twig; my $t = XML::Twig->new( twig_handlers => { 'p[@v!="YES"]' => sub { $_->delete }, }, ); $t->parse(\*DATA); # $t->parsefile( "file.xml"); $t->flush(); __DATA__

The Bye

Border Lamp