title: Getting all combinations of pairs from a list in Ruby
body: <p>I have a list of elements (e.g. numbers) and I want to retrieve a list of all possible pairs. How can I do that using Ruby?</p>
  
  <p>Example:</p>
  
  <pre><code>l1 = [1, 2, 3, 4, 5]
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>l2 #=&gt; [[1,2], [1,3], [1,4], [1,5], [2,3], [2,4], [2,5], [3,4], [3,5], [4,5]]
  </code></pre>