my $L = 4; my @chars = qw[a b c d]; $_ = "aaaabdbbdaccdacdaaabdcd"; my %seen = map {$_, 0} glob do {local $" = ","; "{@chars}" x $L}; {local $" = ""; use re 'eval'; /([@chars]{$L})(?{$seen{$1}++})(*FAIL)/ +;} while (my ($n, $v) = each %seen) { say "$n -> $v"; }
In reply to Re: Permutation with repetitions
by JavaFan
in thread Permutation with repetitions
by umeboshi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |