in reply to HTML table with HTML::Template and loop in a loop
However, what fireartist wanted was the following table:1 2 3 4 5 one two three four five ein zwei drei veir funf hana dool set net dasut yi er san si wu
The desired HTML table output doesn't exactly match the structure of the @data array given in the code. In fact, luckily for fireartist, I don't think this "correct" output is possible to do efficiently with map().1 one ein hana yi 2 two zwei dool er 3 three drei set san 4 four veir net si 5 five funf dasut wu
With that said, the two solutions given by jeffa and cfreak are good starters for the most common HTML::Template situations. For everyone's sanity, it's usually best to keep the internal data structures consistent with the structure of the output table. In this case, the @data structure was symmetric to the output table, but not quite the same (perhaps because of other uses of @data in other code, or just unfamiliarity with HTML::Template). But in about 90% of situations, you want to make your internal data structured in the same way as the output. This way you get to use map(), and these two writeups are right on point for help in those situations (especially jeffa's suggestion to use Data::Dumper).
blokhead
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) 2Re: HTML table with HTML::Template and loop in a loop
by jeffa (Bishop) on Sep 20, 2002 at 04:11 UTC |