$firstrandom = $list1[rand @list1]; push @list2, $firstrandom; $count = $#list1; while ($count != 0) { ###create list2 $random = $list1[rand @list1]; $ispresent = 'false'; for $I (0..$#list2){ ##check to see if team is already in list2 if ($random == $list2[$I]) { $ispresent = 'true' }; }; if($ispresent eq 'false') { ##if not add it to @list2 push @list2, $random; $count--; }; };