12345678 1234 87654321 8765 #### $VAR1 = { 'devices' => { 'device' => [ { 'name' => '12345678', 'id' => '1234' }, { 'name' => '87654321', 'id' => '8765' } ], 'list' => 'true' } }; #### my $hash_ref = XMLin($XML, KeyAttr=>[] , ForceArray=>["device"]); print "The array\n"; print Dumper($hash_ref->{devices}->{device}); print "The first element\n"; print Dumper($hash_ref->{devices}->{device}[0]); print "The first element another way\n"; my @array=$hash_ref->{devices}->{device}; print Dumper($array[0]); #### The array $VAR1 = [ { 'name' => '12345678', 'id' => '1234' }, { 'name' => '87654321', 'id' => '8765' } ]; The first element $VAR1 = { 'name' => '12345678', 'id' => '1234' }; The first element another way $VAR1 = [ { 'name' => '12345678', 'id' => '1234' }, { 'name' => '87654321', 'id' => '8765' } ];