in reply to sort by variable, configurable fields
Unfortunately Perl has no reduce operator yet, so you will have to construct a for loop in your sort function and aggregate the results youself (or break from the loop when the result is clear).
You can't use strings as operators without eval, but you can use code references, e.g.:
[ { KeyName => 'SALARY', SortType => sub { shift <=> shift }, }, { KeyName => 'FIRST_NAME', SortType => sub { shift cmp shift }, } ]
You can then call your code references in the for loop
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: sort by variable, configurable fields
by AnomalousMonk (Archbishop) on Feb 15, 2010 at 19:19 UTC |