T
Tuxedo
Given this data structure:
my @lol = ('level 1.1',
['level 2.1',
'level 2.2',
['level 3.1',
'level 3.2'],
'level 2.3']);
How can I print the LoL with a loop, in the same basic structure, as
follows:
<ul><li>level 1.1
<ul><li>level 2.1</li>
<li>level 2.2
<ul><li>level 3.1</li>
<li>level 3.2</li>
</ul>
</li>
<li>level 2.3</li>
</ul>
</li>
</ul>
And how can I access/print separate level records, such as all in the first
level of the LoL, the second level or the third? Again by a loop. For
example, the output of printing all items in the first level would return:
level 1.1
or in the second level:
level 2.1, level 2.2, level 2.3
or the third level:
level 3.1, level 3.2
I guess a simple way to do this exists? However, I cannot find any similar
examples anywhere.
Many thanks for any tips.
Tuxedo
my @lol = ('level 1.1',
['level 2.1',
'level 2.2',
['level 3.1',
'level 3.2'],
'level 2.3']);
How can I print the LoL with a loop, in the same basic structure, as
follows:
<ul><li>level 1.1
<ul><li>level 2.1</li>
<li>level 2.2
<ul><li>level 3.1</li>
<li>level 3.2</li>
</ul>
</li>
<li>level 2.3</li>
</ul>
</li>
</ul>
And how can I access/print separate level records, such as all in the first
level of the LoL, the second level or the third? Again by a loop. For
example, the output of printing all items in the first level would return:
level 1.1
or in the second level:
level 2.1, level 2.2, level 2.3
or the third level:
level 3.1, level 3.2
I guess a simple way to do this exists? However, I cannot find any similar
examples anywhere.
Many thanks for any tips.
Tuxedo