![]() |
|
Perl-Sensitive Sunglasses | |
PerlMonks |
Re: all permutations of given lenghtby Eily (Monsignor) |
on Aug 11, 2020 at 07:55 UTC ( #11120597=note: print w/replies, xml ) | Need Help?? |
Algorithm::Combinatorics probably has what you want (probably not a permutation though, since it would be the same length as the input, without introducing repetitions). Either variations_with_repetition or combinations_with_repetition should be what you're looking for. The first one considers (A, B, B), (B, A, B), and (B, B, A) to be three different solutions (so produces the three), while the second will only produce (A, B, B) and consider the other two to be identical.
In Section
Seekers of Perl Wisdom
|
|