in reply to Re: Creating a random generator
in thread Creating a random generator

First things first. You say

Anywhere you see (AorAn) is where I hope the perl has a nice little way of looking at the first character of the following word and adding "a" or "an".

If you don't expect too much, this substitution should do that. It changes th word "a" to "an" if the following word begins with a vowel character.

s/\ba(?=\s+[AEIOUaeiou])/an/g
It doesn't deal with "a unicorn" or "an hour" and other vagaries of pronunciation.

As to your code, there's a lot of it and I haven't looked at every line by far. One thing that stands out is that there is little separation of code and data. You have a lot of global hashes and arrays, and later ones seem to rely on earlier ones in uncomfortable ways. Ultimately, these would belong in a single (or a few) configurable hashes, with the configuration data in an external file.

Otherwise, your code has a massive amount of syntax errors, too many to correct on the fly. It will be nearly impossible to debug remotely, relying only on fatalsToBrowser. You must find a way to run your script locally from a shell so that you can eliminate syntax errors before commiting it to a web server (even a local web server), or indeed, for discussion among perl monks.

Anno