title: Reading text file, parsing it, and storing it into a hash. How?
body: <p>I want to open a text file with three lines</p>
  
  <p>3 televisions at 722.49</p>
  
  <p>1 carton of eggs at 14.99</p>
  
  <p>2 pairs of shoes at 34.85</p>
  
  <p><strong>and turn it into this:</strong></p>
  
  <pre><code>hash = {
        "1"=&gt;{:item=&gt;"televisions", :price=&gt;722.49, :quantity=&gt;3},    
        "2"=&gt;{:item=&gt;"carton of eggs", :price=&gt;14.99, :quantity=&gt;1},
        "3"=&gt;{:item=&gt;"pair of shoes", :price=&gt;34.85, :quantity=&gt;2}
         }
  </code></pre>
  
  <p>I'm very stuck not sure how to go about doing this. Here's what I have so far:</p>
  
  <pre><code>f = File.open("order.txt", "r")
  lines = f.readlines
  h = {}
  n = 1
  while n &lt; lines.size
  lines.each do |line|
    h["#{n}"] = {:quantity =&gt; line[line =~ /^[0-9]/]}
    n+=1
  end
  end
  </code></pre>