RE: generating a wordlist from an array of arrays
- From: Scott_Hall@xxxxxxxx (Scott Hall)
- Date: Thu, 29 Sep 2005 16:23:50 -0400
Mark,
I like to use glob for such tasks.
perldoc -f glob
perldoc File::Glob
bash-2.05b$ perl -le 'print for glob ("{a,b}{c}{d,e,f}")'
acd
ace
acf
bcd
bce
bcf
Regards,
Scott
PS: I apologize for the top post.
-----Original Message-----
From: mark berger [mailto:mb@xxxxxxxxxxx]
Sent: Thursday, September 29, 2005 1:27 PM
To: beginners@xxxxxxxx
Subject: generating a wordlist from an array of arrays
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
the only thing i came up with so far, is to generate some for loops
based on the array structure (how many chars, with how many posible
values) on fly and pass this to eval. pretty ugly (at least the way i
thought it out).
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.
--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
For additional commands, e-mail: beginners-help@xxxxxxxx
<http://learn.perl.org/> <http://learn.perl.org/first-response>
.
- Prev by Date: RE: Date in perl
- Next by Date: question on returning value
- Previous by thread: Re: generating a wordlist from an array of arrays
- Next by thread: Perl debugging
- Index(es):
Relevant Pages
|