in reply to Re: working with hashes of arrays
in thread working with hashes of arrays

Grandfather, I can't thank you enough, that is awesome. I can't tell you how much I owe you. Thanks, gman

Replies are listed 'Best First'.
Re^3: working with hashes of arrays
by gman1983 (Novice) on Dec 02, 2008 at 02:35 UTC
    How do I do it with both cards?

      Describe the problem you are trying to solve. My mind reading ability is limited and somewhat spasmodic.


      Perl's payment curve coincides with its learning curve.
        use strict; use warnings; my @hand3 = qw/KsQs JsAs/; my @hand4 = qw/AsKc 2s3s/; my @hand899 = qw/As3c/; my @handsLists = (\@hand3, \@hand4, \@hand899); ##Set my hand my $my_pocket = "AcAs"; #My cards my %pocketCards = map {$_ => 0} $my_pocket =~ /(.{2})/g; printf join '', keys %pocketCards, "\n\n"; for my $hands (@handsLists) { # If either pocket card matches the first hand card omit the hand @$hands = grep {! exists $pocketCards{substr ($_, 0, 2)}} @$hands; print "@$hands\n"; }
        Prints:
        KsQs JsAs 2s3s
        I need it to say:
        KsQs 2s3s
        It any of the cards in my hand are found in either of my opponents cards, then the whole hands needs to be removed from it's @hand?.