in reply to Array Sort
If you don't really care about efficiency, or just to get a feel as what's going on, you can call a function for each items every single time.
Note that the speedups as described in the paper are achieved by essentially calling this extract function only once for each item.# for example, this'll do what you want sub extract_middle { return shift() =~ /-(.*)-/ ? $1 : '' } @sorted = sort { extract_middle($a) cmp extract_middle($b) } @unsorted +;
update Fixed a bug in the sub, thanks moritz
|
|---|