To improve of this, you may have to rethink your data structures. I've had good results by weighting the random choice of the next token based on its frequency of occurence after the prior n tokens (where n==2 in your code).
in reply to Markov Chain Program
One approach would be to extend your data structure along the lines of
and then to use the frequency counts to weight the random choice.
%wordslist = (
'blessed is' => ['the', 47, 'a', 23, 'vroom', 1],
For an object-oriented approach that builds n-deep trees, take a look at