Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: Help with attributes and XML::Simple

by Anonymous Monk
on Aug 01, 2012 at 15:55 UTC ( [id://984823]=note: print w/replies, xml ) Need Help??

in reply to Re: Help with attributes and XML::Simple
in thread Help with attributes and XML::Simple

If you want to use XML::Simple, then this is also one possible solution

my %resulting_vendors; my %vendors = %{ $xmldoc->{Catalog}{Vendors}{Vendor} }; foreach my $vendor2 (keys %vendors ) { print "vendorUniqueKey: [", $vendors{$vendor2}{vendorUniqueKey}, " +], vendor2: [$vendor2]\n"; $resulting_vendors{$vendors{$vendor2}{vendorUniqueKey}}=$vendor2; } print Data::Dumper->Dump( [\%resulting_vendors], [qw(resulting_vendors +)] );

The advantage of this code is, that it only uses things that you also used

The line

my %vendors = %{ $xmldoc->{Catalog}{Vendors}{Vendor} };

isn't really necessary, you can freely use the right part instead of %vendors, if you really want.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://984823]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-05-21 10:16 GMT
Find Nodes?
    Voting Booth?

    No recent polls found