my @chars = ('A' .. 'Z'); my @hand = create_random_letter_list(); print join(", ", @hand), "\n"; sub create_random_letter_list { # 1. Get a new sheet of paper my %list; # 2. Do I have eight letters? while (8 > keys %list) { # 3. Roll the dice and select a random letter my $letter = $chars[int rand @chars]; # 4. If the letter is not on the sheet... if (! exist $list{$letter}) { # ...write it on the sheet $list{$letter}=0; } } # 5. go back to step 2 # 6. Return the list return keys %list; }