title: Hash use array as key in ruby
body: <p>I have a hash that uses array as its key. When I change the array, the hash can no longer get the corresponding key and value:  </p>
  
  <pre><code>1.9.3p194 :016 &gt; a = [1, 2]
   =&gt; [1, 2] 
  1.9.3p194 :017 &gt; b = { a =&gt; 1 }
   =&gt; {[1, 2]=&gt;1} 
  1.9.3p194 :018 &gt; b[a]
   =&gt; 1 
  1.9.3p194 :019 &gt; a.delete_at(1)
   =&gt; 2 
  1.9.3p194 :020 &gt; a
   =&gt; [1] 
  1.9.3p194 :021 &gt; b
   =&gt; {[1]=&gt;1} 
  1.9.3p194 :022 &gt; b[a]
   =&gt; nil 
  1.9.3p194 :023 &gt; b.keys.include? a
   =&gt; true 
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Update:
  OK. Use a.clone is absolutely one way to deal with this problem. 
  What if I want to change "a" but still use "a" to retrieve the corresponding value (since "a" is still one of the keys) ?</p>