title: What decides the order of keys when I print a Perl hash?
body: <p>activePerl 5.8 based</p>
  
  <pre><code>#!C:\Perl\bin\perl.exe
  use strict;
  use warnings;
  
  # declare a new hash
  my %some_hash;
  
  %some_hash = ("foo", 35, "bar", 12.4, 2.5, "hello",
        "wilma", 1.72e30, "betty", "bye\n");
  
  my @any_array;
  @any_array = %some_hash;
  
  print %some_hash;
  print "\n";
  print @any_array;
  print "\n";
  print $any_array[0];
  print "\n";
  print $any_array[1];
  print "\n";
  print $any_array[2];
  print "\n";
  print $any_array[3];
  print "\n";
  print $any_array[4];
  print "\n";
  print $any_array[5];
  print "\n";
  print $any_array[6];
  print "\n";
  print $any_array[7];
  print "\n";
  print $any_array[8];
  print "\n";
  print $any_array[9];
  </code></pre>
  
  <p>Output as this</p>
  
  <pre><code>D:\learning\perl&gt;test.pl
  bettybye
  bar12.4wilma1.72e+030foo352.5hello
  bettybye
  bar12.4wilma1.72e+030foo352.5hello
  betty
  bye
  
  bar
  12.4
  wilma
  1.72e+030
  foo
  35
  2.5
  hello
  D:\learning\perl&gt;
  </code></pre>
  
  <p>What decided the elements print order in my sample code?</p>
  
  <p>Any rule to follow when print a mixed(strings, numbers) hash in Perl? Thank you.</p>
  
  <pre><code>bar12.4wilma1.72e+030foo352.5hello
  </code></pre>
  
  <p><strong>[Updated]</strong></p>
  
  <p>With you guys help, i updated the code as below.</p>
  
  <pre><code>#!C:\Perl\bin\perl.exe
  use strict;
  use warnings;
  
  # declare a new hash
  my %some_hash;
  
  %some_hash = ("foo", 35, "bar", 12.4, 2.5, "hello",
        "wilma", 1.72e30, "betty", "bye");
  
  my @any_array;
  @any_array = %some_hash;
  
  print %some_hash;
  print "\n";
  print "\n";
  print @any_array;
  print "\n";
  print "\n";
  
  my @keys;
  @keys = keys %some_hash;
  for my $k (sort @keys)
  {
      print $k, $some_hash{$k};
  }
  </code></pre>
  
  <p>output</p>
  
  <pre><code>D:\learning\perl&gt;test.pl
  bettybyebar12.4wilma1.72e+030foo352.5hello
  
  bettybyebar12.4wilma1.72e+030foo352.5hello
  
  2.5hellobar12.4bettybyefoo35wilma1.72e+030
  D:\learning\perl&gt;
  </code></pre>
  
  <p>Finially, after called <code>keys</code> and <code>sort</code> functions. The hash keys print followed the rule below</p>
  
  <pre><code>2.5hellobar12.4bettybyefoo35wilma1.72e+030
  </code></pre>