When I study a syntax, I try to use it for any odd task that turns up. We have a contest for a club of sorts where the winner gets a prize of value $25 or so, but the idea is to foster participation. Hence, we don't want perpetual winners or the winner to be the person who sits at his computer all day, so we're choosing a random correct answer as opposed to the first.
Where I'm stuck now is making a composite of the those who answer correctly less those who have already won. I looked for examples in the books I have and couldn't find one. If I were to proceed in the manner of the syntaxes I've studied before, I would loop through indices, making exhaustive comparisons. What is the perl way to remove a sublist from another list
$ perl rand1.pl 7246281254938614119473194136957146644855362901505395617562308444592359 +441659779924940736387588266118823158415004985978328481067994672839164 +223678436588869 2 $ cat rand1.pl #!/usr/bin/perl -w use strict; use feature ':5.10'; use Crypt::Random qw( makerandom ); my $r = makerandom ( Size => 512, Strength => 1 ); print "$r\n"; srand($r); my @winners=("ruth","sheila"); my @correct=("ruth","martin","dee","zack"); my @composite = @correct - @winners; print "@composite \n"; $
Thanks in advance,
In reply to removing a sublist by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |