title: Compare values of two hashes with mixed types
body: <p>I want to compare the hash if the key-value pairs are same in the second hash. I don't want to use smartmatch as it gives warnings. </p>
  
  <p>What is the best way to compare two hashes with integers,strings and maybe also arrays in it?</p>
  
  <pre><code>use warnings;
  use diagnostics;
  
  my $hash1={"key_str"=&gt;"a string", "key_int"=&gt;4};
  my $hash2={"key_str"=&gt;"b string", "key_int"=&gt;2};
  
  foreach my $key ( keys(%$hash1) ) {
      if ($hash1-&gt;{$key} != $hash2-&gt;{$key}) {
          print($key);
      }
  }
  </code></pre>
  
  <p>the output as expected is:</p>
  
  <pre><code>Argument "b string" isn't numeric in numeric ne (!=) at hash_compare.pl line 8 (#1)
      (W numeric) The indicated string was fed as an argument to an operator
      that expected a numeric value instead.  If you're fortunate the message
      will identify which operator was so unfortunate.
  
  Argument "a string" isn't numeric in numeric ne (!=) at hash_compare.pl line 8 (#1)
  </code></pre>