use strict; use warnings; use XML::Simple; my $path = '.'; # add your path here for my $xfile (glob "$path/*.xml") { print "xfile=$xfile\n"; my $xml = XML::Simple->new(); my $file = $xml->XMLin($xfile) or die $!; # do your checks... }