Store the results in a hash. The values don't matter, just use the unique property of hash keys to your advantage.
my %results;
@results{permute(\@possibilities)} = 1;
| [reply] [d/l] |
thanks for info. just need to know where to insert into
the program so it will eliminate repeating permutations.
I did a permutation that should of yielded 420 rearrangements, I ended up with 11 of the same for each
original ( close to 5000 permutations ). I await the
expertise of the all knowing one!
| [reply] |
That depends on what program you're using.
If you're using the snippet from the perlfaq, you'll have to modify it somewhat. The easiest solution would be to return the values instead of printing it. In that case, my solution works as stands.
The FAQ answer is recursive, so modifying it to use a hash internally is non-trivial, and it would take more time to change and to debug. Hope this helps.
| [reply] |
| [reply] |
I ran your program as printed. the following : a a b b b c d
should have yielded 420 permutations. i get 4976 the same
number as how...permut n..". The text you wrote says "To use
it, first sort.... I'm a perl newbie,please give me layman
details to make this program work w/o duplicate permutations
and I will be eternally grateful to you!!!!
email address swanhits@hotmail.com should you choose
to be more direct. thanks waiting on your reply!!!
| [reply] |