This could turn into a golf exercise I suppose.sub compare_hash_keys { my ($h1,$h2) = @_; my @k1 = sort keys %$h1; my @k2 = sort keys %$h2; return @k2 - @k1 if @k1 <=> @k2; for (0..$#k1) { return $k1[$_] cmp $k2[$_] if $k1[$_] cmp $k2[$_]; } 0; }
In reply to Comparing all keys in a hash by rinceWind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |