in reply to Re: creating all possible random 'words' from 4 letters
in thread creating all possible random 'words' from 4 letters
No need to make an array with 26^4 elements!my $str = 'aaaa'; print $str++, $/ while $str le 'dddd';
OK, using increment is fun, so let's be goofy and do it with just [a-d]:
my $str = 'aaaa'; while ($str le 'dddd') { print $str++, $/; 1 while $str =~ s/(.)e/chr(1 + ord $1) . 'a'/e; }
* Update: BrowserUK++ for setting me straight with glob. You learn something new every day here!
blokhead
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: creating all possible random 'words' from 4 letters
by BrowserUk (Patriarch) on Nov 07, 2003 at 19:05 UTC | |
by tye (Sage) on Nov 07, 2003 at 19:26 UTC | |
by BrowserUk (Patriarch) on Nov 07, 2003 at 19:36 UTC | |
by QM (Parson) on Nov 13, 2003 at 14:23 UTC |