use strict; use XML::Simple; for ('./news-arabic-business.xml') { my $xmlfile = $_; my $struct; my $parser = new XML::Simple( forcearray => 1 ); eval { $struct = $parser->XMLin( $xmlfile ); die "wibble " unless ref $struct eq 'HASH'; }; if ($@) { print "$@ \n"; next; }; }