in reply to Perl ( multiple Choice Tests )
Assuming you have some way of identifying the correct answer implies you have access to that data. Therefore you could use List::Util::shuffle once you have all elements in a single list. Something like:
use List::Util qw(shuffle); use Data::Random::WordList; my $correct = "Correct answer"; my $wl = new Data::Random::WordList( wordlist => '/usr/dict/words' ); my @rand_words = $wl->get_words(3); my @answers = shuffle(@rand_words, $correct);
|
|---|