#!/usr/bin/perl -w use strict; use XML::Parser; my %tags; my $p = XML::Parser->new(Handlers => { Start => sub {$tags{$_[1]}++; }, }, ) or die "cannot create parser :: $!"; foreach my $file (@ARGV) { eval { $p->parsefile($file); }; die $@ if $@; } print "The keys are\n"; print map "$_\n", sort keys %tags; print "There are ", scalar(keys %tags), " tags in the files\n";