After much searching I was able to locate a character-level Markov text generator:
http://www.eskimo.com/~rstarr/poormfa/travesty2.html
However, this program terminates once it has reached a certain number of characters. My knowledge of Perl is very limited (the concept of hashes escapes me completely), but I think what I need changed is relatively simple. How would this program be modified so that each word generated is printed on its own line (ie. words are separated by \n instead of ' ') and it terminates after generating a certain number of words, rather than characters?