title: How to access an array element inside a hash in Ruby
body: <p>I have a hash of arrays of coordinates of locations like this:</p>
  
  <pre><code>cities = {
    "l10"=&gt; [41.84828634806966,-87.61184692382812],
    "l11"=&gt; [41.86772008597142,-87.63931274414062],
    "l12"=&gt; [41.88510316124205,-87.60498046875],
    "l13"=&gt;[41.84930932360913,-87.62420654296875]
  }
  </code></pre>
  
  <p>To access the second value in the first array, I tried:</p>
  
  <pre><code>puts cities[0][1][1]
  </code></pre>
  
  <p>I want it to print out <code>-87.61184692382812</code>, but it doesn't. It gives me an error.</p>
  
  <hr>
  
  <p>I am trying to iterate over the hash. Accessing it by using </p>
  
  <pre><code>puts cities["l10"][1]
  </code></pre>
  
  <p>doesn't work. But</p>
  
  <pre><code>puts cities[0][1][1]
  </code></pre>
  
  <p>worked when I converted it into an array.</p>