my @collections = ...; my $first_collection = shift @collections; keys %$first_collection; my ( undef, $max ) = each %$first_collection; while ( my ( undef, $elt ) = each %$first_collection ) { if ( $elt > $max ) { $max = $elt; } } for my $collection ( @collections ) { keys %$collection; while ( my ( undef, $elt ) = each %$collection ) { if ( $elt > $max ) { $max = $elt; } } }