gr0k,
If you have a requirement to allow duplicates in the combination but no more than is present in the original list then the code is easy enough to change.
@_ == keys %{@_,reverse @_);
That is misleading because it also removes duplicates. The difference is you are using letters instead of numbers so there should never be any duplicate. The change you have made to dereference slows the code back down again.
Again, this is a terrible approach since you are spinning cycles needlessly. If you don't believe me:
Formula for determining number of unique combinations of k values in a set of n letters is n!/k!(n-k)!
- 1 = 6
- 2 = 15
- 3 = 20
- 4 = 15
- 5 = 6
- 6 = 1
That is a total of 63 possible combinations you should be testing, but your misuse of Algorithm::Loops has lead to testing 55,986. Unique combination certainly are not permutations.
L~R