in reply to Re^2: 2D array ALL combinations
in thread 2D array ALL combinations

You could make a copy of AoA1 with them grepped out.

my @cleaned_AoA1 = map { grep length, @$_ } @AoA1;

If you don't mind being destructive, you could remove the blank elements from @AoA1.

foreach (@AoA1) { @$_ = grep length, @$_; }

I'm afraid that's the best NestedLoops can do because it can't loop using iterators.

Grepping them out on the fly won't save you any memory.

sub make_scrubber { my ($aref) = @_; return sub { [ grep length, @$aref ] }; } my $iter = NestedLoops( [ map { make_scrubber($_) } @AoA1 ] );