http://www.perlmonks.org?node_id=1021402


in reply to Re: Permutations in reverse order (easy)
in thread Permutations in reverse order

Thank you, tye. You know, I had tried this early on, but discarded the idea at the time because I was still getting inconsistent results with Algorithm::Permute. Algorithm::Permute explicitly doesn't guarantee any order to its results, but it was ordered when the items where initially in lex order (which mine were not). I later found the fine print in the docs, but I didn't think to revisit the $max - $_ transformation. Switching to Algorithm::Loops, combined with this $max - $_ suggestion, was the solution.