James Edward Gray II wrote:

> irb(main):001:0> arr = eval "{{3.1, 1.3, 2.5, 2.1}, {2.1, 3.1, 2.4,
> 2.2}, {1.4, 2.2, 2.1, 4.2}}".tr("{}", "[]")
> => [[3.1, 1.3, 2.5, 2.1], [2.1, 3.1, 2.4, 2.2], [1.4, 2.2, 2.1, 4.2]]
> irb(main):002:0>
> irb(main):003:0* arr.sort { |a, b| a.first <=> b.first }
> => [[1.4, 2.2, 2.1, 4.2], [2.1, 3.1, 2.4, 2.2], [3.1, 1.3, 2.5, 2.1]]

arr.sort_by{|x| x.first }