Re: 1, random; 2, unicode



nobull67@xxxxxxxxx wrote:
Paul Lalli wrote:

my $random_key = (keys %hash)[rand(keys %hash)];
my $random_value = $hash{$random_key};

How is that better than..

my $random_value = (values %hash)[rand(keys %hash)];

Because the OP asked "how to extract a random item from a hash". I
have no idea if that meant "random key" or "random value" or both.
Your method only provides the value.

Paul Lalli

.