good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Extracting data from XML fileby mirod (Canon) |
on Feb 23, 2010 at 10:41 UTC ( [id://824817]=note: print w/replies, xml ) | Need Help?? |
Why do you want to get the result either in an array or in a scalar? Why not always get an array and always process it the same way? Why special case 1-element arrays? Whichever you choose, XML::Simple can do it. If you want to always get an array use the ForceArray option, otherwise don't. If you are only interested in the data in the State elements, then you can use a number of other modules, XML::LibXML, XML::Rules, or my XML::Twig.
In Section
Seekers of Perl Wisdom
|
|