I have a Perl data structure like the following:
%hash = (
table_id => {
column_1_header =>
[
column_value_1,
column_value_2,
column_value_3
],
column_2_header =>
[
column_value_4,
column_value_5,
column_value_6,
column_value_7,
],
},
);
My goal is to produce a series of tables with each of the columns as outlined in the structure. For example:
<table id="table_id">
<tbody>
<tr>
<td>column_1_header</td>
<td>column_2_header</td>
</tr>
<tr>
<td>column_value_1</td>
<td>column_value_4</td>
</tr>
<tr>
<td>column_value_2</td>
<td>column_value_5</td>
</tr>
<tr>
<td>column_value_3</td>
<td>column_value_6</td>
</tr>
<tr>
<td></td>
<td>column_value_7</td>
</tr>
</tbody>
</table>
I am using Perl Dancer and Template Toolkit. What are some options to easily a table like this?
Change the data so it’s grouped by record instead of by column.
The above changes
to
Note the the data structure does not contain enough information to recreate the original column order.