in reply to Splitting a string

I think you are talking about creating a list of bigrams from text ("bigram" is a terms used a lot in "natural language processing" circles, and is a specific flavor of "n-gram"). Presumably, your next step is to look at the likelihood of occurrence for each distinct bigram (i.e. how often "pe" occurs, etc).

So naturally there is a module that does this: Text::Ngram.

The only thing special about your particular case is that you want to ignore spaces (most bigram analyses of text retain the spaces, because they are meaningful for text analysis). But that's fine -- just do  tr/ //d on your string before you pass it to Text::Ngram.