my @x = map join( '', @$_ ), variations_with_repetition( ["a".."z"], 4 );; print scalar @x;; 456976 #### [ 7:10:21.87] C:\test>perl -MAlgorithm::Combinatorics=:all -le"print scalar( () = variations_with_repetition( ["a".."z"], $ARGV[0] ) )" 4 456976 [ 7:10:27.12] C:\test>