- 论坛徽章:
- 0
|
my @dict = ('A'..'E');
GenDict(\@dict, 1, 3, 5, '');
sub GenDict {
my ($list, $pos_begin, $pos_end, $width, $base_str) = @_;
if (0 == $width) {
print "$base_str\n";
return;
}
for ($pos_begin .. $pos_end) {
GenDict($list, $pos_begin, $pos_end, $width - 1, $base_str . $list->[$_]);
}
}
|
要全在一行的话就去掉\n |
|