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";
}