in reply to Column Sort on Array

Picking out the sort from the tangle of unformatted code I see:

my @temp = reverse sort { $a->[0] cmp $a->[0]} @results;

If you compare $a->[0] against $a->[0], it will always be equal, so sort will do nothing. Is that the problem you are experiencing?

Try replacing one of the $a with $b and see what difference it makes.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: Column Sort on Array
by Anonymous Monk on Jul 19, 2008 at 13:16 UTC
    I tried that with no luck. When I run it in Komodo, I notice that variable don't change no matter what I change in that line. I tried this. my @temp = reverse sort { $a->[0] cmp $b->[0]} @results;