#!/usr/local/bin/perl use strict; use warnings; use XML::Simple qw/:strict/; use Data::Dumper; my $xml = qq{ }; my $xml_simple = XML::Simple->new(KeyAttr => 1, KeepRoot => 1, ForceArray => 1); my $output = $xml_simple->XMLin($xml); my %hash = %{$output->{InteractionComponentList}[0]{InteractionComponent}[0]}; print Dumper(\%hash);