in reply to converting hash to shuffled array

You are already looping through the hash, just use rand() to pick a random element out of the hash.
my $r = int(rand(keys %db)); my $i = 0; foreach (keys %db) { if($r == $i){ print qq(<a href="$_"><img src="/images/$db{$_}"></a>); last; } $i++; }

- Tom