#!/usr/bin/perl -w OUTER: @suit=('spades', 'hearts', 'clubs', 'diamonds'); foreach $suit(@suit) { INNER: @types=( "ace","2","3","4","5","6","7","8","9","10","jack","queen","king"); foreach $types(@types) { $card="$types of $suit"; print "$card\n"; $cardcounter++; push(@cards,$card,); } } print "\n"x2; print "$cardcounter cards have been created\n"; print "\n"x2; ATTEMPT: for ($counter=1;$counter<11;) { $i = int(rand(@cards)) ; push (@alreadyused,@cards[$i]); $count=grep (/@cards[$i]/i,@alreadyused); if ($count<2) { print "Random card is: @cards[$i]\n"; $counter++; push (@iterations,@cards[$i]); } else {next ATTEMPT;} } print "\n"x2; $number=@iterations; print "$number random cards have been chosen, with no duplicates";