http://qs321.pair.com?node_id=11121500


in reply to Combinations of multiple arrays

Simple map-in-map algorithm.

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=817521 use warnings; my @list = ([0..1], [2..4], [5..8]); my @sets = []; for my $eacharray ( @list ) { @sets = map { my @prev = @$_; map [ @prev, $_ ], @$eacharray } @sets +; } use Data::Dump 'dd'; dd @sets;