##
## ##
use strict;
use warnings;
use XML::Twig;
my $twig = new XML::Twig( twig_handlers => { TRADE => \&TRADE } );
$twig->parsefile('1513.xml');
$twig->set_pretty_print('indented');
$twig->print_to_file('out.xml');
sub TRADE {
my ( $twig, $TRADE ) = @_;
foreach my $c ($TRADE->children('EVENT'))
{
$c->cut($TRADE) unless
$c->att('eventtype') eq "PROC"
;
}
}