#!/usr/bin/perl -w use strict; my @cards = ( ['tux', 'tux'], ['tux', 'gates'], ['gates', 'gates'] ); my $hits = 0; my $total = 1000; for(1..$total) { my $draw = $cards[rand @cards]; my $front_idx = int rand 2; my $back_idx = !$front_idx; redo if $draw->[$front_idx] ne 'tux'; if($draw->[$back_idx] eq 'tux') { $hits++; } } print $hits, " of ", $total, "\n";