in reply to Number Combinations With Replacement
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:
[1, 1] [1, 2] [2, 1] [2, 2] [download]