package Playing_Card_Deck;

use strict;

@Playing_Card_Deck::suits = qw
   [Diamonds Clubs Hearts Spades];
@Playing_Card_Deck::pips = qw
   [Two Three Four Five Six Seven Eight Nine Ten
    Jack King Queen Ace];





sub new

 {my $invocant = shift;
  my $class = ref($invocant) || $invocant;
  my @cards = ();
  foreach my $suit (@Playing_Card_Deck::suits)
     {foreach my $pip (@Playing_Card_Deck::pips)
         {push(@cards, {suit => $suit, pip => $pip});}}
  return bless([@cards], $class);}

sub deal


 {return %{ shift( @{shift(@_)} ) };}

sub shuffle



 {our @deck; local *deck = shift;
    
  for (my $n = $
     {my $k = int rand($n + 1);
      @deck[$k, $n] = @deck[$n, $k] if $k != $n;}}

sub print_cards

 {print "$_->{pip} of $_->{suit}\n" foreach @{shift(@_)};}