On Sep 29, mark berger said:

hey list. i stuck with gererating a wordlist from a changing
multidimensional array. each entry in the array contains a list with the
possible values.

You want a "cartesian cross product". And there's a module out there that does just that: Set::CrossProduct.

  http://search.cpan.org/~bdfoy/Set-CrossProduct-1.6/CrossProduct.pm

Sample use:

  use Set::CrossProduct;

  my $iterator = Set::CrossProduct->new(['a','b'],['c'],['d','e','f']);

  my @wordlayout = $iterator->combinations;

@wordlayout will be an array of array references (like ['a','c','f']). To turn them into strings, you could do:

  my @wordlayout = map join("", @$_), $iterator->combinations;

any hints on how to solve this? probably using recursion but i got no
idea about it right now. and sorry for my bad english, hope i can make
my problem understandable.

It would be a fun exercise to do this on your own, and yes, recursion is the most obvious way to do it.

--
Jeff "japhy" Pinyan        %  How can we ever be the sold short or
RPI Acacia Brother #734    %  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to