my @picks; my %seen; for (1..5) { # Five numbers my $pick = int(rand(15000)) + 1; # in 1..15000. redo if $seen{$pick}++; push @picks, $pick; }