use strict;
use warnings;
use Math::Combinatorics;
use List::Util qw( first );
my @A = 'A' .. 'Z';
my @B = 0 .. 9;
my $count = 0;
my $comb_A = Math::Combinatorics->new( count => 3, data => [@A] );
while( my @combo_A = $comb_A->next_combination ) {
my $comb_B = Math::Combinatorics->new( count => 2, data => [@B] );
INNER: while( my @combo_B = $comb_B->next_combination ) {
my %overlap;
@overlap{@combo_B} = ();
next INNER if first{ exists $overlap{$_} } @combo_A;
print join( ' ', @combo_A, @combo_B ), "\n";
$count++;
}
}
print "Whew, that resulted in $count result-producing iterations!\n";