Somehow I think this is some standard problem handled in CS texts, Knuth should have more about it than you'd ever want to know. A Super Search for Permutations turns up Algorithm::Permute (suggested by AltBlue here) and Permuting with duplicates and no memory by tye.
In reply to Re: Uniquely sorting arrays
by Corion
in thread Uniquely sorting arrays
by $CBAS
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |