more useful options | |
PerlMonks |
Re^2: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1'sby LanX (Saint) |
on Sep 19, 2020 at 15:38 UTC ( [id://11121947]=note: print w/replies, xml ) | Need Help?? |
> so you need recursion (or fake it). so here a recursive version with global variables (because I also wanted to provide a solution with two nested loops "faking" recursion, but gave up) NB: it's optimized for the dual case, where it's easier to set 0s into a string full of 1s.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|