#!/usr/local/bin/perl-w use strict; use warnings; use XML::Simple; my $path = 'C:\Documents and Settings\user\Desktop\output2\FITS\ IMD025350802'; # 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 $!; if (($file->{identification}{'identity'}{'format'} eq 'JPEG File Interchange Format') && ($file->{filestatus}{'well-formed'}{'content'} eq 'true') && ($file->{filestatus}{'valid'}{'content'} eq 'true')) }