vcherubini
Programmer
Hello PERL programmer world. Man I love PERL, too bad Larry Wall is deciding to stop the upgrading of it right?<br><br>Well anyway, on to my question. Ok, I am making a blackjack game in PERL, and I need help on randomly picking the card names from an array.<br><br>This is what I have set up so far<br><br><FONT FACE=monospace># this is where the card are picked from random <br><br>$house_cards = ("", @house_cards[ map { rand @house_cards} (5 .. 7) ]);<br><br># the players cards, will also be picked from random<br> @player_cards = ("two ", "three ", "four ", "five ", "six ", "seven ", "eight ", "nine ", "ten ", "jack ", "queen ", "king ", "ace "
;<br><br># types of cards, will be randomly matches with a randomly picked card number<br> @types = ("heart ", "diamond ", "club ", "spade "
;<br><br></font><br><br>Ok, in case you are a little lostm all I have set up are two arrays with the names of all the types of cards that you can have a long with they card type, ie heart, diamond, etc. The scalar that says $house_cards is a variable that defines what cards to pick randomly, but the problem with that is it picks the same two cards everytime (and obviously that is not random whatsoever). I got that piece of code from the Perl Cookbook (by O'Reilly) which I think is the best PERL book ever, but it is not working for what I need it to do.<br><br>I have tried the <FONT FACE=monospace>rand()</font> function and that fails without prevail also.<br><br>So, if anyone can help, I would be very appreciative.<br><br><br>Thanks a lot, and lets all give a shout out to all the kick @$$ PERL programmers out there! <br><br>Thanks a lot in advance,<br><br>Vic Cherubini<br>CEO V O I D Interactive.com<br>(site up soon)