title: Ruby: match first, second, this etc elements from a dimensional array
body: <p>I have an array of arrays. I want to concatenate the first, second, third elements of arrays.</p>
  
  <p>Example arrays:</p>
  
  <pre><code>a =  [[4, 5, 6], [1, 2, 3], [8, 9, 10]]
  a1 = [[1, 2, 3], [8, 9, 10]]
  a2 = [[4, 5, 6], [1, 2, 3], [8, 9, 10], [11, 21, 31]]
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>out of a:  [[4,1,8],[5,2,9],[6,3,10]]
  out of a1: [[1,8],[2,9],[3,10]]
  out of a2: [[4,1,8,11],[5,2,9,21],[6,3,10,31]]
  </code></pre>