#! perl -T use strict; use warnings; # set number of coconutsouffles the punter has to eat if they stick with or change choice. my $stickycoconutsouffle=0; my $coconutsouffle=0; for(1..99999){ #set boolean flag (punter guess is false until correct) my $tf = undef; # punter guesses correctly first time, set correct to true if(int(rand(3))==2){ $tf = ! $tf }; # increase count for punter sticking with choice if they are correct; $stickycoconutsouffle++ if $tf; # increase count for punter changing choice and being correct after container removed $tf = ! $tf; $coconutsouffle++ if $tf; } # end for # how many souffles does our punter get? print $/."Sticking with original choice they recieve $/$/$stickycoconutsouffle Coconut Souffle's.".$/x2, "Changing their original choice they recieve $/$/$coconutsouffle Coconut Souffle's.".$/x2; exit 0; ------------------------- results Sticks with original choice they recieve 33172 Coconut Souffle's. Changing their original choice they recieve 66827 Coconut Souffle's.