arr = arr.sort_by {|x| x.length}
Or in 1.8.7+:
arr = arr.sort_by(&:length)
You can also use sort:
sort
arr.sort{|x, y| x.length <=> y.length}
arr = arr.sort{|x,y| x.length - y.length} works too.
arr = arr.sort{|x,y| x.length - y.length}