#!/usr/local/bin/perl -w use strict; use Algorithm::Numerical::Shuffle qw(shuffle); srand(); my @array1=(); my $Max_Questions = 30; #Will vary upon how many questions #the person wants to answer my $ref = random(\@array1,$Max_Questions); sub random{ my $array = shift; my $Max = shift; my $lines = 100; #There is a function that gets the #number of lines in the actual data #file, but there will be at least 100. @$array = (shuffle (0..$lines))[0..$Max_Questions]; my @sorted = sort {$a<=>$b} @$array; print"Element\t\tUnsorted\tSorted\n"; print"-------\t\t--------\t------\n"; for(my $z = 0;$z<$Max;$z++){ print" $z"; print"\t\t @$array[$z]\t\t"; print" $sorted[$z]\n"; } }