title: Sort hash keys of nested hash
body: <p>In perl, I have a hash that looks like the following:</p>
  
  <pre><code>   $hash{key1}-&gt;{a} = 1;
     $hash{key1}-&gt;{b} = 3;
  
     $hash{key2}-&gt;{a} = 4;
     $hash{key2}-&gt;{b} = 7;
  
     $hash{key3}-&gt;{a} = 2;
     $hash{key3}-&gt;{b} = 5;
  </code></pre>
  
  <p>How can I sort the keys of this hash by the value of key <code>a</code>. For instance, sorting the above hash in numerical ascending order by the values of key <code>a</code> would give: key1,key3,key2.</p>