If you had typed permutations into the search bar at the top of each page you would have found an answer to your question without having to wait for a response. You could use Super Search to find lots of discussions on how to deal with permutations and combinations in Perl.