in reply to Re: Sort Array by length of Value
in thread Sort Array by length of Value

too simple, i didn't see it...

@combos = reverse sort {length(uc($a)) <=> length(uc($b))} @combos;

sigh, thanks for pointing it out, i guess i was searching way too far.

regards,

Emanuel

Replies are listed 'Best First'.
Re: Re: Re: Sort Array by length of Value
by shenme (Priest) on Oct 06, 2003 at 14:44 UTC
    You don't need the reverse if you compare reversed values to begin with.
    @b = sort { length $b <=> length $a } @a;
    But then I also wonder if the order of the values _after_ sorting on length might be significant.   You might want to consider something like this:
    @b = sort { length $b <=> length $a || $a cmp $b } @a;