in reply to Re^3: unordered sets of N elements
in thread unordered sets of N elements

dragonchild,
That may be where using one of those nifty CPAN modules and sorting/joining/hashing comes into play.
#!/usr/bin/perl use strict; use warnings; use Algorithm::Loops 'NestedLoops'; my (@combo, %seen); my %roll = ( 'type1' => { 'sides' => 6, 'count' => 2 }, 'type2' => { 'sides' => 8, 'count' => 2 }, ); my $die = 4; my $iter = NestedLoops( [ map { ( [1..$_->{sides}] ) x $_->{count} } values %roll ], { OnlyWhen => \&ok } ); print "@combo\n" while ( @combo = $iter->() ); sub ok { my $key = join '' , sort @_; return undef if exists $seen{$key} || length $key != $die; $seen{$key} = undef; return 1; }

Cheers - L~R