Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: help to preserve the order of hash

by herveus (Parson)
on Jun 24, 2010 at 12:19 UTC ( #846291=note: print w/replies, xml ) Need Help??


in reply to Re^2: help to preserve the order of hash
in thread help to preserve the order of hash

Howdy!

True, but it does not appear to do what the OP needs. As I read the POD, it appears that the top level structure returned by XMLin is always a hashref. At any given level, the keys in the hash are the distinct tags that appear at that level. If there are multiple instances of a tag, each instance is an element in an array of hashes.

ForceArray simply forces that behavior even if there is only one instance of the tag. It does not appear that there is any way to make XMLin return an arrayref.

The POD does describe the limitations, and the OP has run smack into one of them. The suggested course of action is "use a different module". Hacking (for some value of "hacking") XML::Simple to use Tie::IxHash internally is certainly one way to go there; the OP will have to decide which approach will work best for this problem.

yours,
Michael
  • Comment on Re^3: help to preserve the order of hash

Replies are listed 'Best First'.
Re^4: help to preserve the order of hash
by LanX (Chancellor) on Jun 24, 2010 at 16:21 UTC
    > Howdy!

    Gr Gott! :)

    Sure I was wondering myself about the hashref, but I didn't (and still don't) want to dig to deep into the problem, (just communicate the little bit of observation:)

    Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://846291]
help
Chatterbox?
[thezip]: My doggies love it when it snows
[perldigious]: As long as you are a good "boy scout" stevieb, more power to you... but I like my Jeep, and don't like the idea of rolling it or crashing it in to anything. :-)
[thezip]: Me, not as much.
[perldigious]: Mine too thezip, especially my German Shepherd. He looks like he is about to die of heat exhaustion all summer, so he goes nuts when winter comes and he can play in the snow.
[stevieb]: my main off-road vehicle nowadays is a strengthened mercedes ML320. I'm very hard on it, but I've never had any real issues at all (I love how small and light it is, and it has a very, very good centre of gravity for how I roll)
[perldigious]: "for how I roll"... ahhh, I see what you did there stevieb.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2016-12-06 16:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (112 votes). Check out past polls.