in reply to this doesn't sort

Use:

@bigArray = sort { $a->[$sortNdx] <=> $b->[$sortNdx] } @bigArray;

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.

The start of some sanity?

Replies are listed 'Best First'.
Re^2: this doesn't sort
by hsfrey (Beadle) on Feb 26, 2012 at 06:36 UTC
    Yes, That did it perfectly! :-) Thank you!

    But I don't understand it! I can't even make syntactic sense out of it. :-(

    I tried replacing $a->[$sortNdx] with [$a][$sortNdx], which I thought would be syntactically the same thing, but got a syntax error.

    Could you explain to me what's going on?

    Thanks.

      Inside the sort block, $a and $b are elements of @bigArray, not indexes into it.

      So if @bigArray contains array refs, both $a and $b end up being an array ref. And you can dereference and index into an array with the $a->[$index] syntax.

      On the other hand if you write [$a], you wrap the array ref in $a into another array ref -- not what you want.

      See perlreftut and perlref for more details.

        Thanks so much!