title: Comparing two Hash of arrays for equality
body: <p>I want to compare two hash of arrays to see if they are equal. That is, the key values should contain the same elements.</p>
  
  <pre><code>my %h1 = (
      w1 =&gt; ['3','1','2'],
      e2 =&gt; ['6','2','4'],
      r1 =&gt; ['8', '1'],
  );
  
  my %h2 = (
      w1 =&gt; ['3','1','2'],
      e2 =&gt; ['6','2','4'],
      r1 =&gt; ['8','1'],
  );
  
   my %h3 = (
      w1 =&gt; ['3','1','2'],
      e2 =&gt; ['6','2','4'],
      r1 =&gt; ['4','1'],
  );
  
  my $i = 0;
  
  foreach ( keys %h2 ){
      my $conditional = scalar keys %h2;  # 3
      if ([sort @{$h1{$_}}] ~~ [sort @{$h2{$_}}]) {
          $i++;
      }
      if ($i eq $conditional){
          print "true\n";
      }
  }
  </code></pre>
  
  <p>Comparing <code>%h1</code> and <code>%h2</code> should return true since they are equal. Comparing <code>%h1</code> and <code>%h3</code> prints nothing. 1) Is there a better way of doing this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I would like to do this without using a function from a module.</p>