use XML::Simple; my $xml = new XML::Simple (KeyAttr=>[]); my $data; eval { $data = $xml->XMLin("cmd-out\/$hostname.xml"); }; if ( $@ ){ die "$@"; }