Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
this would be stored in an AoA called @results, where each row is an array of project_id, variable_id and symbol_id, where a row is an element of @results. From this I would like to create a table like so:p_id | v_id | s_id 1 | 1 | 1 2 | 1 | 2 3 | 1 | 3 4 | 1 | 4 1 | 2 | 5 2 | 2 | 6 3 | 2 | 7 4 | 2 | 8 2 | 3 | 9 4 | 3 | 10 1 | 4 | 11 2 | 4 | 12 4 | 4 | 13 3 | 5 | 14
It doesnt matter too much if the pipelines are there or not, I just need the data aligned for easy reading. At the moment I use nested for loops to generate this. This becomes a problem when a symbol doesnt exist for a particular variable in a project. The way it works is it appends a symbol to a string named $row when it exists...if it doesnt nothing happens, so I get something like the following table...| p_1 | p_2 | p_3 | p_4 | --------------------------------- v_1 | s_1 | s_2 | s_3 | s_4 | v_2 | s_5 | s_6 | s_7 | s_8 | v_3 | | s_9 | | s_10 | v_4 | s_11 | s_12 | | s_13 | v_5 | | | s_14 | |
Any ideas how I might solve this? Thanks, Steve| p_1 | p_2 | p_3 | p_4 | --------------------------------- v_1 | s_1 | s_2 | s_3 | s_4 | v_2 | s_5 | s_6 | s_7 | s_8 | v_3 | s_9 | s_10 | v_4 | s_11 | s_12 | s_13 | v_5 | s_14 |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Create a table from a matrix
by TedPride (Priest) on May 24, 2006 at 17:57 UTC | |
|
Re: Create a table from a matrix
by saintmike (Vicar) on May 24, 2006 at 17:04 UTC | |
|
Re: Create a table from a matrix
by davidrw (Prior) on May 24, 2006 at 17:49 UTC | |
|
Re: Create a table from a matrix
by ruzam (Curate) on May 24, 2006 at 22:31 UTC | |
|
Re: Create a table from a matrix
by Praveen (Friar) on May 26, 2006 at 11:15 UTC | |
|
Re: Create a table from a matrix
by Anonymous Monk on May 25, 2006 at 12:23 UTC |