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")In reply to (tye)Re: Funky sorting
by tye
in thread Funky sorting
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |