use strict; use warnings; use XML::Twig; my $twig = XML::Twig->new ( twig_handlers => { Preroll => \&handleNode, Midroll => \&handleNode, Postroll => \&handleNode, } ); $twig->parse (do {local $/; }); sub handleNode { my ($tag, $elt) = @_; my $creative = $elt->first_child ('Creative'); print "Creative: ", $creative->text (), "\n"; } __DATA__