in reply to Select randomly from a hash
What's wrong with:
%verbs = {"jumped","eat","killed"}; %pronouns = {"I","You","He","She"}; my @pronouns = shuffle keys %pronouns; foreach my $verb (shuffle keys %verbs) { print shift(@pronouns), ' ', $verb, "\n"; @pronouns = shuffle keys %pronouns if (scalar(@pronouns) == 0); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Select randomly from a hash
by Fletch (Bishop) on Oct 17, 2004 at 01:35 UTC | |
Re^2: Select randomly from a hash
by davido (Cardinal) on Oct 17, 2004 at 03:50 UTC |