Hello Monks
I got this following problem:
I got a hash which I want to get into xml. My problem is that the content (keys) of the hash are ordered alphabetically. Thus the content comes into a different order to file. This is not a problem to xml itself but a problem for the tool-chain following my perl script, which expects things to be in a specific order
My hash is generated and looks in the end like this
my $TGROUP = {
COLS => 4,
COLSPEC => [... Array of hashes...],
TBODY => HASH(0x8b...),
THEAD => HASH(0x8bc...)
}
and it comes it this order to xml
<TRGROUP...
<COLS ...
<COLSPEC ..
<TBODY ....
<THEAD ...
>
but the tool requires it in a different order:
<TRGROUP...
<COLS ...
<COLSPEC ..
<THEAD ....
<TBODY ...
>
Therefore it would be simplest to reorder the sequence of keys in the hash.. i.e. like that:
my $TGROUP = {
COLS => 4,
COLSPEC => [... Array of hashes...],
THEAD => HASH(0x8b...),
TBODY => HASH(0x8bc...)
}
Is this somehow possible to do? I tried to create the hash once more in a different order but this does not work.
Any help is highly welcome!
best regards!
Tobias
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.