From: Ammar Ali Date: 2010-11-13T02:17:26+09:00 Subject: Re: help sorting objects by their instance field On Fri, Nov 12, 2010 at 7:12 PM, Ammar Ali wrote: > It sorts the array itself, no need to make a copy. Sorry. I gave you wrong information. Probably need more coffee. >> a = [[1,3], [3,2], [5,1]] => [[1, 3], [3, 2], [5, 1]] >> a.sort_by {|e| e[1]} => [[5, 1], [3, 2], [1, 3]] >> a => [[1, 3], [3, 2], [5, 1]] Regards, Ammar