pastorizah has asked for the wisdom of the Perl Monks concerning the following question:

Can someone please help me figure out how to put some randomly generated numbers into ascending order using arrays. look at my program thus far:
#!/usr/bin/perl # Generate 10 random numbers between 1 and 1000 for ($x=0;$x<10;$x++) { print int (rand(1000) + 1) ."\t"; if ($x%5==0) { print "\n"; } } END;

janitored by ybiC: Balanced <code> tags around codeblock

Replies are listed 'Best First'.
Re: Array in ascending order
by pbeckingham (Parson) on May 21, 2004 at 18:25 UTC

    Do what you were advised to do before, and sort the reuslts.

    my @a = sort {$a <=> $b} map {int (rand (1000) + 1)} 1..10;