in reply to Re^2: counting instances of one array in another array
in thread counting instances of one array in another array

Re: your ps - see my ngram2number routine above. It does exactly that calculation.

Update: after re-reading my original message, I note that you also need to translate a list of characters into an alphabet to use the function (just in case it was not understood from the original code). You can do that with:

sub charlist2alphabet { my %results; for my $index ( 0 .. (@_ - 1) ) { $results{ $_[ $index ] } = $index; } \%results; } my $alphabet = charlist2alphabet( @charlist );
or
my $alphabet = { map { ( $charlist[ $_ ] => $_ ) } ( 0 .. @charlist - +1 );

--MidLifeXis