#! perl -sw use strict; # get available numbers from somewhere. my @available = (100..999); # shuffle them $a = $_ + rand @available - $_ and @available[$_, $a] = @available[$a, $_] for (0..$#available); my @lists; # move the randomly distributed numbers into 10 lists 10 at a time. $lists[$_] = [ splice( @available, 0, 10) ] for 1..10; # to use and discard the next number from the 5th list my $next = pop @{$lists[5]}; print "list[$_]=( @{$lists[$_]} )\n" for 1..10; __END__ # Output Note: The number used and discarded from the 5th list. C:\test>198405.pl C:\test>198405.pl list[1]=( 473 849 328 853 535 166 196 138 466 553 ) list[2]=( 998 533 640 693 564 555 498 766 614 294 ) list[3]=( 527 195 722 886 751 458 134 186 246 556 ) list[4]=( 461 120 694 440 387 221 938 862 971 439 ) list[5]=( 457 957 446 976 397 403 425 748 966 ) list[6]=( 870 877 139 776 496 271 378 811 565 472 ) list[7]=( 942 414 463 358 146 958 168 728 158 338 ) list[8]=( 162 169 509 268 815 716 410 629 965 705 ) list[9]=( 842 468 203 412 651 130 343 539 219 177 ) list[10]=( 734 224 275 658 127 810 874 649 844 633 ) C:\test>