#!/bin/perl use strict; use warnings; use XML::Twig; use Tie::IxHash; my %Items; my $Output_Filehandle; tie %Items, "Tie::IxHash"; my $twig=XML::Twig->new( twig_handlers => {_all_ => sub {my $Item_master_Ancestory = $_->ancestors; my $element_match = ($_->tag); my $text = ($_->trimmed_text); my $coupled = join( ' - ' => " "x$Item_master_Ancestory,$element_match,keys %{$_->atts},values %{$_->atts},$text); if (!defined $Items{$coupled}){$Items{$coupled}=1} else {$Items{$coupled}++;} }, } ); $twig->parsefile( '500syncItemMaster.xml'); # build it $twig->purge; # clear end of document from memory open(SUMMARY, ">United perl parser summary.txt"); my @k = keys %Items; foreach my $k (@k) {print SUMMARY ("$k => $Items{$k}\n");}; #### z ####