in reply to Re: this doesn't sort
in thread this doesn't sort

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.

Replies are listed 'Best First'.
Re^3: this doesn't sort
by moritz (Cardinal) on Feb 26, 2012 at 06:42 UTC

    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!