title: sorting of hashes in perl
body: <p>I have an array of references to hashes:</p>
  
  <pre><code>@array=($ref1,$ref2,$ref3);
  </code></pre>
  
  <p>Each ref point to a hash with the same keys but different values.
  I have to sort the hashes according to the values of KEY (one of keys in hashes).
  Later I have to print out the values of all keys of all hashes but sorted.</p>
  
  <p>Example:</p>
  
  <pre><code>%h1=(KEY=&gt;1,name=&gt;John,sport=&gt;football);
  %h2=(KEY=&gt;52,name=&gt;Kate,sport=&gt;football);
  %h3=(KEY=&gt;7,name=&gt;April,sport=&gt;basketball);
  </code></pre>
  
  <p>As a result I want to get it in the order: </p>
  
  <blockquote>
    <p>%h1,%h3,%h2</p>
  </blockquote>