in reply to Help XML Search and replace

You need to let XML::Simple know that subcategory, product and prod_id are arrays, even if you use them only once. Replace your XMLin line with this one and read about KeyAttr and ForceArray in the XML::Simple pod.
my $xml = XMLin( (join'', <DATA>), KeyAttr => 1, 'ForceArray' => [qw/ +subcategory product prod_id/]);
Boris

Replies are listed 'Best First'.
Re^2: Help XML Search and replace
by Maxim (Sexton) on Sep 28, 2004 at 19:10 UTC
    Thanks guys!! It really help me. Big Thanks
Re^2: Help XML Search and replace
by Maxim (Sexton) on Sep 28, 2004 at 20:29 UTC
    What you have gave to me work but I can't change any value. It seems my loops doesn't search the appropriate value. Any ideas?? Thanks
      It would be helpful if you tell us, what you like to modify.
      This little peace of code show your data structure.
      use Data::Dumper; my $d = XMLin( (join'', <DATA>), KeyAttr => 1, 'ForceArray' => [qw/subcategory product prod_id/] ); print Dumper($d);
      Boris
        I fix up the bug. I didn't put correctly the name of the arrays into my loop. What you give me really works. Thanks a lot Man ;).