I find even more intuitive to use permutations directly:
use strict; use warnings; use feature 'say'; use Algorithm::Combinatorics qw(permutations); my $zeros = 7; my $ones = 3; # if you want the iterator force scalar context, as in: # my $iter = permutations(\@data); say join('',@$_) for permutations( [ (0) x $zeros, (1) x $ones] );
In reply to Re^2: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's -- permutations
by Discipulus
in thread Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's
by Lana
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |