Transpose data into a 2 dimensional array.

D

deepak p

Hello Perl Gurus,

Can someone show me how to transpose data into a 2 dimensional array.
I searched for examples similar to my need in the newsgroup, but could
not find one thats close :-( I have listed sample data .txt file
below. Assume all data lines are unique and sorted. I appreciate your
time and providing me education.

Kind regards,
Deepak


AAA|a01|BBB|b01|0
AAA|a01|BBB|b02|5
AAA|a01|BBB|b03|2
AAA|a02|BBB|b01|1
AAA|a02|BBB|b02|2
AAA|a02|BBB|b03|2
AAA|a03|BBB|b01|5
AAA|a03|BBB|b02|4
AAA|a03|BBB|b03|2
...
...

Would like output result file to be transposed like.

Res|a01|a02|a03
b01|0|1|5
b02|5|2|4
b03|2|2|2

Later, I need to put it into an html table such as AAA spans
horizontally across 2 table cells of the first row and BBB spans
vertically across the first column.

|AAA|AAA|AAA|
|a01|a02|a03
BBB|b01|0|1|5
BBB|b02|5|2|4
BBB|b03|2|2|2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top