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:

That is a good way if your file isn't too big because it has to read the entire file into memory first. Actually all sorting will have to read the file into memory but some ways might be more memory efficient and some ways might be more time efficient. The code I posted is a good balance between memory and efficiency as long as the file isn't too big to fit into memory. Some reading if you are interested: