in reply to Generating lists of strings
Here's a method using Algorithm::Combinatorics.
use Algorithm::Combinatorics qw(variations_with_repetition); my $length = 4; my @data = qw(1 2 3); my $iter = variations_with_repetition(\@data, $length); while (my $p = $iter->next) { print join("",@$p)."\n"; }
|
|---|