A First Solution (cont) 

package Board;

sub try {
  my($self, $index, @deck) = @_;
  
  if($index > 8) {
    $self->dump;
    return;
  }

  foreach (0..$#deck) {
    my $first = shift @deck;
    foreach my $i (0..3) {
      $self->place($index, $first, $i) || next;
      foreach (0..$#deck) {
        $self->try($index + 1, @deck);
        push @deck, shift @deck;
      }
    }
    push @deck, $first;
  }
}