in reply to Re: XML::Simple parsing into a hash wierd behaviour
in thread XML::Simple parsing into a hash wierd behaviour

ForceArray does not help here. The issue here: XML::Simple by default takes "name" as the key attribute.

Peter (Guo) Pei

  • Comment on Re^2: XML::Simple parsing into a hash wierd behaviour

Replies are listed 'Best First'.
Re^3: XML::Simple parsing into a hash wierd behaviour
by ikegami (Patriarch) on Apr 20, 2010 at 06:19 UTC

    Did you try it?

    Without ForceArray => [qw( type )]:

    $VAR1 = { 'type' => { 'scenario1' => { 'report' => 'Dummy2' }, 'default' => { 'report' => 'Dummy1' } } }; $VAR1 = { 'type' => { 'report' => 'Dummy1', 'name' => 'default' } };

    With ForceArray => [qw( type )]:

    $VAR1 = { 'type' => { 'scenario1' => { 'report' => 'Dummy2' }, 'default' => { 'report' => 'Dummy1' } } }; $VAR1 = { 'type' => { 'default' => { 'report' => 'Dummy1' } } };

    That's exactly the output the OP requested.