Part 2 redefines J from jack to joker, making jokers wildcards when determining type of hand but the lowest value when comparing individual cards. This requires very little modification to the part 1 program:
my $cardlist = "AKQT98765432J";
Change the card sort order;
my $jokers = grep { $_ eq "J" } @cards;
count the jokers;
++ $tally{$_} foreach grep { $_ ne "J" } @cards;
omit the jokers when counting cards for type of hand;
$ofakind[0] += $jokers;
and in this poker variant, simply add the count of jokers to the count of the most-frequent card when determining type of hand.