title: Is it possible to iterate  through a hash in sorted order using the while(my($key, $value) ... ) {} method?
body: <p>For a hash of this format:</p>
  
  <pre><code>my $itemHash = {
      tag1 =&gt; {
          name =&gt; "Item 1",
          order =&gt; 1,
          enabled =&gt; 1,
      },
      tag2 =&gt; {
          name =&gt; "Item 2",
          order =&gt; 2,
          enabled =&gt; 0,
      },
      tag3 =&gt; {
          name =&gt; "Item 3",
          order =&gt; 3,
          enabled =&gt; 1,
      },
      ...
  }
  </code></pre>
  
  <p>I have this code that correctly iterates through the hash:</p>
  
  <pre><code>keys %$itemHash; # Resets the iterator
  while(my($tag, $item) = each %$itemHash) {
      print "$tag is $item-&gt;{'name'}"
  }
  </code></pre>
  
  <p>However, the order that these items are iterated in seems to be pretty random. Is it possible to use the same <code>while</code> format to iterate through them in the order specified by the 'order' key in the hash for each item?</p>
  
  <p>(I know I can sort the keys first and then foreach loop through it. Just looking to see if there is cleaner way to do this.)</p>