my $twig = new XML::Twig::XPath( TwigHandlers => { #ITPSL header parsing data "/itpslsig/itpslheader/ontology/weightmatrix" => \&getwm, "/itpslsig/itpslheader/ontology/detectby" => \&getdetectmethods, "/itpslsig/itpslheader/ontology/os" => \&getos, "/itpslsig/itpslheader/ontology/osver" => \&getosver, #ITPSL body parsing data "/itpslsig/itpslbody/mainblock/mainop" => \&getmainop, "/itpslsig/itpslbody/mainblock" => \&getnoofsubblocks, "/itpslsig/itpslbody/mainblock/subblock" => \&parsesubs, }); # parse, handling nodes on the way $twig->parsefile( shift @ARGV );