use Algorithm::Combinatorics qw[ combinations_with_repetition ];; $i = combinations_with_repetition( [ 'a'..'z' ], 6 );; undef %stats; ++$stats{ sig( join'', @$comb ) } while defined( $comb = $i->next ); printf "Ave. collisions:%.2f Max. collisions:%.2f\n", 736281 / keys(%stats), max( values %stats );; Ave. collisions:1438.05 Max. collisions:4061.00 pp\%stats;;