title: How to clear a Perl hash
body: <p>Let's say we define an anonymous hash like this:</p>
  
  <pre><code>my $hash = {};
  </code></pre>
  
  <p>And then use the hash afterwards. Then it's time to empty or clear the hash for
  reuse. After some Google searching, I found:</p>
  
  <pre><code>%{$hash} = () 
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>undef %{$hash}
  </code></pre>
  
  <p>Both will serve my needs. What's the difference between the two? Are they both identical ways to empty a hash?</p>