
perl-novice
New User
Jul 28, 2009, 12:14 PM
Post #1 of 5
(738 views)
|
|
Advanced sorting question.
|
Can't Post
|
|
I'm trying to program in Perl a way to sort a table of data by one specific column, similar to how you sort in Excel ("Data"-"Sort"-"Sort by"). Say you have a table as follows: Var1 Var2 Var3 Total Bill 11 13 18 42 Bob 20 16 27 63 John 8 23 22 53 Mark 32 24 17 73 I want to sort a table by the "Total" column, so the end result looks like this: Var1 Var2 Var3 Total Bill 11 13 18 42 John 8 23 22 53 Bob 20 16 27 63 Mark 32 24 17 73 I am aware of sorting arrays and such in Perl, but my thinking is that if I sort the Total column, it will only sort that column, and not adjust the rest of the table accordingly. Example: Var1 Var2 Var3 Total Bill 11 13 18 42 Bob 20 16 27 53 John 8 23 22 63 Mark 32 24 17 73 How do I code this correctly? Thanks!
|