In Perl, how can I get the Cartesian product of multiple sets?

前端 未结 5 1643
無奈伤痛
無奈伤痛 2021-01-01 22:52

I want to do permutation in Perl. For example I have three arrays: [\"big\", \"tiny\", \"small\"] and then I have [\"red\", \"yellow\", \"green\"]

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-01 23:27

    You can use my Set::CrossProduct module if you like. You don't have to traverse the entire space since it gives you an iterator, so you're in control.

提交回复
热议问题