⭐ in reply to How do I select a random key from a hash?
But you are computing the keys twice, and that's expensive for large hashes. Perhaps this instead:
do { my @k = keys %hash; $k[rand @k] } [download]
-- Randal L. Schwartz, Perl hacker