title: Traversing a multi-dimensional hash in Perl
body: <p>If you have a hash (or reference to a hash) in perl with many dimensions and you want to iterate across all values, what's the best way to do it.  In other words, if we have
  $f->{$x}{$y}, I want something like</p>
  
  <pre><code>foreach ($x, $y) (deep_keys %{$f})
  {
  }
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>foreach $x (keys %f) 
      {
      foreach $y (keys %{$f-&gt;{$x}) 
      {
      }
  }
  </code></pre>