I'm not quite sure if I understood your problem correctly, but Algorithm::Loops might solve it. At least it makes it easy to produce all possible combinations of dynamically computed lists.
Perl 6 - links to (nearly) everything that is Perl 6.
Comment on Re: how to make a foreach loop dynamic?