How do you select a random hash key? For my Flash+Perl card game I\'m trying to pick a random card from a hash where keys are: \"6 spades\", \"6 clubs\", etc. like this:
Here's another way (demonstrating how to pick a random element from a list of unknown length):
my $cards; my $chosen; while ( my $card = each %{$user->{HAND}} ) { $chosen = $card if rand(++$cards) < 1; }