use XML::Twig; use strict; my $file = shift; # set up the XML parser: my $twig= XML::Twig->new( comments => 'keep', twig_handlers => { row => \&row_processing }, pretty_print => 'indented', ); print " parsing $file...\n"; $twig->parsefile($file); $twig->purge; sub row_processing { my($twig, $rows)= @_; print "a row\n"; }