Using glob is pretty inventive. I like it, except that you generate a really big list
*. As long as you're using all 26 letters, the increment operator will give you the list iteratively:
my $str = 'aaaa';
print $str++, $/ while $str le 'dddd';
No need to make an array with 26^4 elements!
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!