http://www.perlmonks.org?node_id=1021329

midget2000x has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to figure out some code that will loop thru pre-defined lists and output all combinations (concatenations). Specifically of shirts and size/color/etc options.

For example, here are some lists:

http://thewhiteroom.com/permutations.jpg

My code needs to output something like this: SKU1TSBLU
SKU1TSGRN
SKU1TSWHT
SKU1TSBLK
SKU1TMBLU
SKU1TMGRN
SKU1TMWHT
SKU1TMBLK
...
SKU5H2XWHT
SKU5H2XBLK

So basically every combination of every option for each sku.

I have been doing some looping and can get there in a very ugly, inefficient manner, but I just know there's an easier way.

Any help appreciated.