Perl: the Markov chain saw | |
PerlMonks |
Re^3: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's -- permutationsby choroba (Cardinal) |
on Sep 18, 2020 at 09:12 UTC ( [id://11121904]=note: print w/replies, xml ) | Need Help?? |
It returns far more results than needed, as they are repeated, because for permutations, zero at position 0 is different to zero at position 1.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
In Section
Seekers of Perl Wisdom
|
|