in reply to Re^5: XML File Creation in Perl
in thread XML File Creation in Perl

Thanks Ken. I will look in detailed documentation on this. Also, I agree with your point on and the same i also mentioned that it is expected. My point is If i have multiple combinations of root, table, NEW2 isn't that every time the loop runs it overwrites the old value because we are storing $key for  $xml_data->{$root}{$table}{NEW2}{KEY} So to avoid that, i used $xml_data->{$root}{$table}{NEW2}{$key} = [$key]; but it resulted into
<ABC>ABC</ABC> <DEF>DEF</DEF>
, without this it displays only the last row with that combination in the file <KEY>DEF</KEY>

Replies are listed 'Best First'.
Re^7: XML File Creation in Perl
by kcott (Archbishop) on Apr 17, 2013 at 07:25 UTC

    Instead of assigning:

    $xml_data->{$root}{$table}{NEW2}{KEY} = [$key]

    Try pushing:

    push @{$xml_data->{$root}{$table}{NEW2}{KEY}}, $key;

    There's a few examples of that in the code I posted earlier.

    -- Ken