Algorithm::MarkovChain implements a class capable of creating a Markov chain, and then generating output based on it. For more information consult the Algorithm::MarkovChain(3) man page.