What I essentially want to do is take a table like this one, where the top row contains columns names:
A B B B
a 9 8 9
a 6 5 3
b 4 4 5
b 8 3 4
and merge the columns with the same names while keeping the corresponding row names (contained in the first column) like so:
A B
a 9
a 8
a 9
a 6
a 5
a 3
b 4
b 4
b 5
b 8
b 3
b 4
Any help would be appreciated.
What you are trying to do is 'melt' a table. I've used a library for this in R but not in Perl. There is a Perl module called Data::Table
which does have a melt function for multidimensional lists.