in reply to Make random numbers

Hello GHMON,

You have received several answers to your question. Just for fun another approach.

Initially you create an array of 1 - 1000 values. Then you use the random function to choose an element from this array and the same time when you choose an element you remove it from the array to make sure on your final array you will not have it again :)

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @original = 1 .. 1000; # print Dumper \@array; my @array; push @array, splice(@original, rand @original, 1) for (1 .. 100 ); print Dumper \@array; __END__ $VAR1 = [ 848, 909, 62, . . . etc

If you really want to push things even more (not that makes a difference but just for fun). You can shuffle the original array before you choose the value randomly:

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use List::Util qw(shuffle); my @original = 1 .. 1000; # print Dumper \@array; @original = shuffle(@original); my @array; push @array, splice(@original, rand @original, 1) for (1 .. 100 ); print Dumper \@array; __END__ $VAR1 = [ 319, 793, 69, 571, . . . etc

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!