gman1983
I don't fully understand your problem, but it seems that you are having problems dealing with having duplicate cards in players hands. To avoid that, I suggest that you deal with it right from the start, that is, right when you are dealing the cards to the players. So my suggestion is:
# build the original deck of cards
my @card_values = (2, 3, 4, 5, 6, 7, 8, 9, 10, 'V', 'D', 'R', 'A');
my @hearts = map {$_." h"} @card_values;
my @clubs = map {$_." c"} @card_values;
my @diamonds = map {$_." d"} @card_values;
my @spades = map {$_." s"} @card_values;
# scramble the deck of cards
sub scramble {
my @original_deck = (@hearts, @clubs, @diamons, @spades);
@deck = ();
while (@original_deck) {
push @deck, splice(@original_deck, rand(@original_deck), 1);
}
}
Now you have a pile (array) of 52 scrambled, and not repeated, cards that you can start shifting to deal them to the players. Whenever you want to give a card, you just shift one from the @deck. For instance, if you want to give me a hand of 5 cards:
my @hand = ();
push @hand, shift @deck for 0..4;
That was my approach when I wrote the single player Place your bets