title: Copying values from one hash to another in perl
body: <p>I have two hashes, one big and one small. All of the smaller hash's keys show up in the bigger hash, but the values are different. I want to copy the values from the bigger hash to smaller hash.</p>
  
  <p>E.G.:</p>
  
  <pre><code># I have two hashes like so
  %big_hash = (A =&gt; '1', B =&gt; '2', C =&gt; '3', D =&gt; '4', E =&gt; '5');
  %small_hash = (A =&gt; '0', B =&gt; '0', C =&gt; '0');
  # I want small_hash to get the values of big_hash like this
  %small_hash = (A =&gt; '1', B =&gt; '2', C =&gt; '3');
  </code></pre>
  
  <p>An obvious answer would be to loop through the keys of the small hash, and copy over the values like this</p>
  
  <pre><code>foreach $key (keys %small_hash) { $small_hash{$key} = $big_hash{$key}; }
  </code></pre>
  
  <p>Is there a shorter way to do this?</p>