my $length = 10; my $ones = 4; my $str = ("1" x $ones) . ("0" x ($length - $ones)); while(1) { print "$str\n"; $str =~ s/^(0*)(1*)10/${2}${1}01/ or last }
In reply to Re: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's
by salva
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: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |