in reply to all permutations of given lenght

Now that you have a module to use, Dominus' Higher Order Perl will probably provide some insights. There are also lots of variations of this question asked and answered here on PM.