use strict; use warnings; my @random_set; my %seen; for (1..10) { my $candidate = int rand(1185); redo if $seen{$candidate}++; push @random_set, $candidate; } print join(', ', @random_set), "\n";