All pastes #253814 Raw Edit

Mine

public text v1 · immutable
#253814 ·published 2006-11-21 03:16 UTC
rendered paste body
#!/usr/bin/perl
use strict;

my @people = qw / diane theresa van terry shannon mandy leo /;

my %lastyearpicks=(
                        'diane' => 'mandy',
                        'leo'   => 'shannon',
                        'mandy' => 'terry',
                        'shannon' => 'theresa',
                        'terry' => 'van',
                        'van'   => 'diane',
                        'theresa' => 'leo'
                );

our %assigned;
foreach my $diva (@people) {
        my $d_id=int(rand(7));
        while ( $diva eq $people[$d_id] or defined($assigned{$people[$d_id]}) or $lastyearpicks{$diva} eq $people[$d_id] ) {
                $d_id=int(rand(7));
        }
        $assigned{$people[$d_id]}=1;
        print "$diva has $people[$d_id]\n";
}