time perl -MAlgorithm::Combinatorics=:all -wle' my $i=variations_with_repetition(["a".."z"],$ARGV[0]); my @x; push @x, join "", @$_ while $_=$i->next; print scalar @x' 4