Laurent_R, for 1 level it is rather easy to use list.

list($tab, $type, [$value1, $value2]);

Now if either of those have a list too, it starts to get complicated.

list($tab, $type, [ [$value1, { inlist => [ $inlist1_type, [ $value1a, $value1b ] ], cla +ss => $value1class }], [$value2, { inlist => [ $inlist2_type, [ $value2a, $value2b ] ]}], ]);

And if it goes deeper.

list($tab, $type, [ [$value1, { inlist => [ $inlist1_type, [ $value1a, $value1b ] ], cla +ss => $value1class }], [$value2, { inlist => [ $inlist2_type, [ [$value2a, { inlist => [ $inlist2a_type, [$value2a1, $value2a2 ] ] +}], [$value2b, { style => 'font-size: small' }] ]]}], ]);

A lot more than the inner lists goes into the hash refs: class, id, style, lang, various javascript attributes. For list items there is also value, so if $value2's inlist were an ordered list (but not starting at 1), I would do the following, and will have to for some lists...

list($tab, $type, [ [$value1, { inlist => [ $inlist1_type, [ $value1a, $value1b ] ], cla +ss => $value1class }], [$value2, { inlist => [ $inlist2_type, [ [$value2a, { inlist => [ 'o', [ [$value2a1, { value => '2' }], $value2a2 ]]}], [$value2b, { style => 'font-size: small' }] ]]}], ]);

For example, I own books 2-5 of Bio of a Space Tyrant by Piers Anthony, so I would like to write the data like...

#2 Mercenary # Politican # Executive # Statesman

For for another series of novels, it is even odder.

#41 The Soldier's of Fear #47 Q-Space

Writing the subroutines to make HTML lists was kind of fun, but it is a lot of work to use it.

No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
Lady Aleena

In reply to Re^2: Need help with filling a complicated data structure by Lady_Aleena
in thread Need help with filling a complicated data structure by Lady_Aleena

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.