Algorithm::FastPermute generates all the permutations of an array. You pass a block of code, which will be executed for each permutation. The array will be changed in place, and then changed back again before "permute" returns. During the execution of the callback, the array is read-only and you'll get an error if you try to change its length.
The Perl module is available as 32-bit and 64-bit: