Wednesday, April 23, 2008

The Joys of Perl

I've been studying perl, so as to be more able to use it for a variety of computing tasks.

So I came upon a bit of perl script that generates random sentences in English. The code can be found here.

I downloaded and ran the script, and this was the sentence that was produced:

i had the greatest confusion imaginable

I assume this is truly random chance, although I would believe that it might be a little bit of a joke on me as well.

The script also produced this sentence:

i began with all possible wariness

It only seems appropriate.

Running the script again produced this:

as soon as you know he was going to say i did the doctor and me there for some time in some other way and did not want the money is a fool as to say he suddenly turned round in his pocket book i had to tell her i thought they were a few more inheritances

There's nothing like computer generated randomness for a little cheap entertainment. Incidentally, the script uses the texts of Crime and Punishment, Great Expectations, Robinson Crusoe, and Around the World in 80 Days to seed the random phrase generator.

1 comment: