How about ?
my $MontysChoice; if( $doors[ choice ] ne 'car' ) { $MontysChoice = grep{ $doors[ $_ ] eq 'car' } 0 .. 2; } else { $MontysChoice = ( grep{ $_ != $choice } 0 .. 2 )[ rand 2 ]; }
In reply to Re^10: Marilyn Vos Savant's Monty Hall problem
by BrowserUk
in thread Marilyn Vos Savant's Monty Hall problem
by mutated
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |