From: Ilan Berci Date: 2007-03-26T23:18:23+09:00 Subject: Re: sorting an array based on two attributes of objects senthil wrote: > > Thanks for some of your replies for the lst post i need small > modification in that post .. i want to sort the salary in descending > order. i have explained the same quesion again.... > I came up with this which is sub par as I test for a condition twice so stay tuned for a better solution.. irb(main):001:0> [['d',100],['c',200],['b',50],['a',100]].sort {|a,b| b[1]==a[1]?a[0]<=>b[0]:b[1]<=>a[1]} => [["c", 200], ["a", 100], ["d", 100], ["b", 50]] hope this helps ilan -- Posted via http://www.ruby-forum.com/.