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