|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Answer: How do I write my own sorting routine? |
| ( #316312=categorized answer: print w/ replies, xml ) | Need Help?? |
|
Q&A > sorting > How do I write my own sorting routine? contributed by jarich
If you have a hash which specifies an ordering for values, then your sorting is much easier:
Now to sort, we just compare the array elements as keys into the hash: Hence: would sort into:
|
|
||||||||||||||||||||