From: Stefano Crocco Date: 2008-08-12T19:21:20+09:00 Subject: Re: Need sort help On Tuesday 12 August 2008, jazzez ravi wrote: > Hi All, > > a=[["raja",1],["Arun",5],["babu",3]] > > I want to sort 1,3,5 > > So i expect output in this order --> raja, babu, arun > > Any methods available for this ? > > > Regards, > P.Raveendran > RF,Chennai > http://raveendran.wordpress.com a.sort_by{|i| i[1]} Array#sort_by calls the block for each element of the array, and uses the return value as a key to use in sorting. I hope this helps Stefano