in reply to Writing processed html from Html::Parser

with select
use autodie; { open my($out), '>', 'out.xml'; my $saver = select $out; my $parser = HTML::Parser.... print ... # all output goes into $out; select $saver; } print "all output goes back into STDOUT";
or with SelectSaver
use autodie; use SelectSaver; { open my($out), '>', 'out.xml'; my $saver = SelectSaver->new($out); my $parser = HTML::Parser.... print ... # all output goes into $out; } print "all output goes back into STDOUT";

Replies are listed 'Best First'.
Re^2: Writing processed html from Html::Parser
by nglenn (Beadle) on Jan 14, 2011 at 19:01 UTC
    Thanks! This works great.