peterstriker has asked for the
wisdom of the Perl Monks concerning the following question:
Hi, I am completely new to computer programmming. I am working through 'Perl By Example, 4th edition'. I have been stuck for hours on the following end-of-chapter exercise... Could somebody please provide the correct script? I am not going to submit what I have done so far as I do not want to embarass myself :P.
'Write a script that will print 10 random cards from a deck.
a. The script will build a deck of 52 cards by using nested foreach loops.
b. The outer loop will iterate through a list consisting of cards for each suit: clubs, diamonds, hearts, spades. The inner loop will iterate through a list for each type of card within the suit: ace, 2 through 10, jack, queen, king. A card of each suit will be assigned to an array.
c. The rand() function will be used to get a random card from the pack. There should be no duplicates.'