in reply to Filtering large XML files

You had a segfault with something easy as the folliwing code?
This just print the text inside text tags. Note that the flush will print his output and clear it while purge only clear it.
use XML::Twig; my $t= XML::Twig->new(pretty_print => 'indented', twig_handlers => { 'text'=>sub{ print $_[1]->text; $_[0]->purge; # or: # my $useful = $_[1]->text; # my $ret_val = some_sub_that_p +rocess_it_further($useful); # $_[0]->purge; }, } );

HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Filtering large XML files
by PT (Novice) on Feb 23, 2015 at 11:24 UTC
    I don't remember exactly, but it was nothing much more fancy. I might try Twig again if LibXML does not work to my needs. Thanks!