in reply to Re: How do I sort a multidimensional arrays?
in thread How do I sort a multidimensional arrays?

In our last episode, we saw:
@array = [8,9,10], [4,5,6], [7,8,9]; @sorted = sort { $a->[1] <=> $b->[1] } @array
in which our nearly knowledgable hero is probably now thumping his head on his desk, realizing that he should have written:
@array = ([8,9,10], [4,5,6], [7,8,9]); @sorted = sort { $a->[1] <=> $b->[1] } @array
Because the precedence rules say so, otherwise the second and third element are just tossed off to never-never land.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE: RE: Answer: How do I sort a multidimensional arrays?
by reptile (Monk) on May 30, 2000 at 01:50 UTC

    You're right about that. I wasn't paying attention and just copied the line from the question. DOH.

    72656B636148206C72655020726568746F6E41207473754A