title: how to sort an array of arrays by three or more elements (ruby)
body: <p>I have csv file with 14 columns and I want to sort it in ruby by 6th column then by 2nd and then by 11th column. </p>
  
  <p>There is nice method .sort_by but it works only for two columns, doesn't it. And <code>array_of_arrays.sort_by {|e| [e[2], e[0],e[1]],}</code> doesn't work.</p>
  
  <p>so let's say in the sample below I want it to be sorted by 3rd,1st,2nd columns</p>
  
  <pre><code>array_of_arrays = [[1,9,'a'],[2,2,'a'], [2,6,'b'], [1,3,'a'], [2,1,'b']]
  
  array_of_arrays.each {|line| puts line.inspect }
  puts
  array_of_arrays.sort_by {|e| [e[2], e[0]]} .each {|line| puts line.inspect }
  </code></pre>
  
  <p>but the result is not as desired </p>
  
  <pre><code>[1, 9, "a"]
  [2, 2, "a"]
  [2, 6, "b"]
  [1, 3, "a"]
  [2, 1, "b"]
  
  [1, 9, "a"]
  [1, 3, "a"]
  [2, 2, "a"]
  [2, 6, "b"]
  [2, 1, "b"]
  </code></pre>