As a Perl-Newbie, I'm currently dealing with a programming problem and would like to hear some tipps of someone more experienced in Perl-programming. I'm trying to sort some measurements which I loaded from some SQL-tables in Perl-lists. There are lists with the following structure:
Requirement: If there are more than one try for a measurement, the different tries should be listed next to each other in the same row.@MeasurementType = (MeasurementA, MeasurementB, Measurement C, Measure +mentB, MeasurementB,..........); @MeasurementValue = ( 1A, 3A , 3A , 2A, 5A, ……); @MeasurementTry= (1 , 1 ,1 , 2 , 3, ….); @MeasurementTime= (DateA, DateB, DateC, DateD, DateE,.....); [ All lists have the same length, since they should be seen together, +as their single elements represent the different measurements e.g..Measurement[0]= @MeasurementType[0],@MeasurementValue[0],@Measur +ementTry[0],@MeasurementDate0] I'm trying to create a list, which creates an output like: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ [Measurement] --[1.Try (MeasurementDate, MeasurementValue]--[2. Try]-- +[3.Try] MeasurementA -- DateA, 1A -- ______-- _______ MeasurementB -- DateB, 3A -- DateD,2A -- DateE,5A MeasurementC -- DateC, 3A -- ______-- _______ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Whats the best way to do this?
Since Perl doesn't support two-dimensional arrays, I would try to connect the seperate lists with an additional list where I save references to them.
Doing so, I can use a "for each" to easily print out all measurements.
Unfortunately, this will only list all measurements underneath each other.
Measurements, which have been done more than one time (see MeasurementB in example) shouldn't be added as multiple rows, but as as 2nd or 3rd try in the same row from the first try.
Anyone of you got an advice how to accomplish this?
In reply to Sorting measurements by Jenny1990
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |