A slight change to your code can help:
my %seen; for my $x (0..9) { my $element = $quest[rand @quest]; redo if $seen{$element}++; print $element; }
You set the element as a key to the hash, and you test to see if you have already used that element.
--In reply to Re: Picking unique element in random from a array
by Leviathan
in thread Picking unique element in random from a array
by rsriram
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |