my $infile= XML::Twig->new( twig_roots => { 'MEMBER' => 1, 'ACCOUNT' => 1 }, twig_handlers => { 'MEMBER' => \&process_member, 'ACCOUNT' => \&process_account }, keep_encoding => 1, ); $infile->safe_parsefile( $incomingFilename );