my $tee = IO::Tee->new($frufile, $vegfile); my $twig = XML::Twig->new( ... etc. twig_print_outside_roots => $tee, ... ); $twig->parse( *DATA );