I have numbers in an array how do extract them in a random order ? . I want to feed them to a sql query to extract information , just the first 10 of them code ###################################################### $dbh =DBI ->connect($data_source, $username, $password) or die "cant connect to $data_source : my $dbh-> errstr\n"; my $sth1 = $dbh -> prepare("select num from tests where subject = '$test' "); $sth1 -> execute or die " unable to execute query "; #$sth1 -> finish;
$count1 = 0; my $array_ref = $sth1->fetchall_arrayref(); foreach $row(@$array_ref){ $num1 = $row->[0]; push(@numbers, $num1); $count1++; } ########### # now to extract them $num = rand(@numbers) $dbh =DBI ->connect($data_source, $username, $password) or die "cant connect to $data_source : my $dbh-> errstr\n"; my $sth1 = $dbh -> prepare("select * from tests where num = '$num1' "); $sth1 -> execute or die " unable to execute query "; Help Jim f