in reply to Re: How do I sort a multidimensional arrays?
in thread How do I sort a multidimensional arrays?
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.@array = ([8,9,10], [4,5,6], [7,8,9]); @sorted = sort { $a->[1] <=> $b->[1] } @array
-- 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 |