Doing permutation of different arrays in perl

Posted by nubie2 on Stack Overflow See other posts from Stack Overflow or by nubie2
Published on 2010-03-16T18:34:58Z Indexed on 2010/03/16 18:41 UTC
Read the original article Hit count: 407

Filed under:
|
|

Hello!

I want to do permutation in perl. For example I have three arrays. ["big", "tiny", "small"] and then I have ["red", "yellow", "green"] and also ["apple", "pear", "banana"].

How do I get:

["big", "red", "apple"] ["big", "red", "pear"]

..etc..

["small", "green", "banana"]

I understand this is called permutation. But I am not sure how to do it. Also I don't know how many arrays I can have. There may be three or four, so I don't want to do nested loop.

© Stack Overflow or respective owner

Related posts about perl

Related posts about permutation