use List::Util 'max'; my @h_refs = ($hash_w, $hash_x, $hash_y, $hash_z); my ($max, $max_i); for ( 0 .. $#h_refs ) { my $max_v = max values %{ $h_refs[$_] }; if ( ! defined $max || $max_v > $max ) { ($max, $max_i) = ($max_v, $_); } } print "The max value is $max\n"; print "It is in the hash referenced by index $max_i\n";