in reply to Re: Funky sorting
in thread Funky sorting
Yeah, that index threw me for quite a while. I think a more accurate replacement is:
however (sort first by length and sort strings of the same length lexigraphically).@v= sort { length($a) <=> length($b) || $a cmp $b } @v;
Basically, the use of index doesn't end up changing anything since $a can only be a substring of $b if it is either shorter than $b or it is exactly equal to $b.
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (tye)Re: Funky sorting
by blakem (Monsignor) on Nov 10, 2001 at 05:03 UTC | |
|
Re: (tye)Re: Funky sorting
by Anonymous Monk on Nov 10, 2001 at 05:46 UTC |