From: Gary Wright Date: 2009-03-19T00:38:20+09:00 Subject: Re: Complex sort of matrix possible, e.g. like Excel? On Mar 18, 2009, at 6:16 AM, Robert Klemme wrote: > You can as well do > > arr.sort_by {|a,b| [a[0]<=>b[0], b[1]<=>a[1]]} This doesn't seem quite right to me. Shouldn't it be: arr.sort_by { |item| [item[0], item[1]] } sort_by will use Array#<=> to compare the two element array and Array#<=> simply uses <=> on each element. Gary Wright