in reply to Which Permute or other module can give me all possible subsets of 6 numbers out of 40?
If I understand you correctly, this is the basic example of NestedLoops from Algorithm::Loops:
use Data::Dumper; use Algorithm::Loops 'NestedLoops'; my $depth = 6; my $range = 40; NestedLoops( [[1..$range], ( sub { [$_+1..$range] } ) x ($depth-1)], s +ub { print Dumper \@_})
If you want to create all those pairings in memory, NestedLoops can also give you the list instead of invoking a callback.
|
|---|