The same way I showed in the previous example. You can nest the cmd:forXXX any way you like. You just have to know which keys/indexes point to arrayrefs, which to hashrefs and which to scalars. And use the cmd:forkey, cmd:forkeys or filter the cmd:foreach or cmd:foreachkey to select/filter them right. The filters specified as the values of the cmd:foreach and cmd:foreachkey attributes are Perl expressions that expect to find the key/index in $_, I'll have to provide access to the value or the whole array/hash as well so that you could filter using the values, butI think it should handle any combination of references. Provided that the data structure is consistent. That is, if it's an array of hashes of something then the value of the key {Foo} in all hashes has the same type.

Plus actually there is no reason why couldn't the cmd:foreach handle plain scalars the same way as a ref to a one element array.


In reply to Re^4: Datastructures to XML by Jenda
in thread Datastructures to XML by Jenda

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.