Thanks Robert and Raul. Both solutions worked. I have finally used: row[1..4].sort_by {|a| a.to_i} Regards, Andreu. Andreu wrote: > I read a line from a CSV file as the following: > fooone,22,114,66,125,footwo