We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
For small amounts of data and with a simple way of extracting the key string the technique BrowerUK suggests is a good solution. If finding the key is expensive or the amount of data being sorted is large such that the sort processing takes a long time a common technique is the schwartzian transform. Consider:
Prints:
The key to the process is to transform the data into a form that can be sorted, sort it, then transform it back again. The process really runs from right to left with the right most map generating a temporary transformed list (with the original data as the first element of each list item. The sort is in the middle. Then the left most map pulls the original string out of each item in the sorted list.
True laziness is hard work
In reply to Re: Array Sort
by GrandFather
|
|