From: "Jesús Gabriel y Galán" Date: 2008-03-29T20:17:27+09:00 Subject: Re: Help on best way to gather/sort results [Array/Hash]? On Sat, Mar 29, 2008 at 6:02 AM, Tony De wrote: > I've read through a number of > the post on sorting Arrays and Hashes. And yet I can't seem to put my > finger on the solution. I want to sort on the second column. sort_by is your friend. This is an example: irb(main):002:0> result = [[1,2,3],[4,5,6],[1,3,7],[3,2,1]] => [[1, 2, 3], [4, 5, 6], [1, 3, 7], [3, 2, 1]] irb(main):003:0> result.sort_by{|a| a[1]} => [[1, 2, 3], [3, 2, 1], [1, 3, 7], [4, 5, 6]] Regards, Jesus.