On Thu, Sep 29, 2005 at 07:26:51PM +0200 mark berger wrote: > 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. > > fe: > > @wordlayout = ((a, b), # possible values for 1st char > (c), # possible values for 2nd char > (d, e, f)); # possible values for 3rd char > > the following wordlist should be generated: > > acd > ace > acf > bcd > bce > bcf
use references for multidimensional arrays: #!/usr/bin/perl use warnings; @w1 = (["a", "b"], ["c"], ["d", "e", "f"]); $str =""; foreach $k (@{$w1[0]}) { foreach $l (@{$w1[2]}) { $str = [EMAIL PROTECTED]" "; } } @w2 = split " ", $str; foreach (@w2) { print "$_\n"; } it's another solution ... hth -- GĂ©rard -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>