Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am wondering how to use the following subroutines found in the article: Permutations and combinations, and was wondering how I can change it slightly so that for each combination, there IS replacement. Right now, the code just does combinations without replacement. I am not sure how to do this in Perl. Any help would be greatly appreciated!
Wouldn't feeding the permute function with like arguments give what you want?
print "[", join(", ", @$_), "]\n" for permute([1,2], [1,2]);has this for output: