in reply to
how are the number of buckets in a perl hash chosen

Choosing a good hash function is a bit of a black magic. Modulo prime might yield a better bucket distribution in simple cases with simple hash functions, e.g. when the keys fall into regular label+number pattern.

In practice, the modulo operation (by a variable) is often insufferably slow compared to arithmetic shift or masking. Therefore, power-of-two bucket sizes are preferred, together with a robust hash function. Strong (and randomized) hash function is a necessity nowadays. Does the course mention security aspects of generic hash implementations, such as resistance to DoS attacks?