title: How to optimize two-dimensional hash traversing in Perl?
body: <p>I have a hash of hashes <code>%signal_db</code>. A typical element is: <code>$signal_db{$cycle}{$key}</code>. There are 10,000s of signals, and 10,000s of keys.</p>
  
  <p>Is there any way to optimize (timewise) this piece of code:</p>
  
  <pre><code>foreach my $cycle (sort numerically keys %signal_db) {
      foreach my $key (sort keys %{$signal_db{$cycle}}) {
          print $signal_db{$cycle}{$key}.$key."\n";
      }
  }
  </code></pre>
  
  <p>The elements have to be printed in the same order as in my code.</p>