From: "Ismail M." Date: 2012-11-30T18:55:59+09:00 Subject: Re: sorting data from a file Hello everybody! i have a txt file which contains numbers as mentioned earlier..then i made a method that shows the ranking rules. def majority() @majority = @rank[3] if @rank[3] == @rank[4] then @majority = @rank[4] end if @rank[4] == @rank[5] then @majority = [5] end if @rank[5] == @rank[6] then @majority = @rank[6] end so, how do i sort that file by the ones who has the lowest value of @majority. i thought about using sort_by method..but i dont know how to use it in my case. -- Posted via http://www.ruby-forum.com/.