time perl -wle ' $n = shift; die "need a number" unless $n and $n =~ /^\d+$/; $a = "a" x $n; $c = 0; $e = 26**$n; while () { push @x, $a; $a++ and $c++; last if $c == $e } print scalar @x' 4 #### time perl -MAlgorithm::Combinatorics=:all -wle ' $n = shift; die "need a number" unless $n and $n =~ /^\d+$/; @_ = ("a".."z"); $i = variations_with_repetition(\@_,$n); while ($c = $i->next){ for (@$c) { $x .= $_ } push @x, $x; undef $x } print scalar @x' 4