title: Append key/value pair to hash with << in Ruby
body: <p>In Ruby, one can append values to existing arrays using &lt;&lt;:</p>
  
  <pre><code>a = []
  a &lt;&lt; "foo"
  </code></pre>
  
  <p>but, can you also append key/value pairs to an existing hash?</p>
  
  <pre><code>h = {}
  h &lt;&lt; :key "bar"
  </code></pre>
  
  <p>I know you can do:</p>
  
  <pre><code>h[:key] = ""
  h[:key] &lt;&lt; "bar"
  </code></pre>
  
  <p>but that's not I want.</p>
  
  <p>Thanks.</p>