Each my for the same variable will mask the previous contents of that variable so it is effectively lost to your script. So only use my once for each variable.
As for opening and reading your text files, I don't know how large they are, but if they have quite a size, the web-server will take a big hit if for every access to your script it has to read a huge file just to get a few random lines. In such case it is much better to put all your lines in database and get the content from the database.
Finally, where did you get the random_line subroutine? I see it nowhere defined in your script, so I would be surprised if it works.
PS: I wouldn't bother with finding the second to last letter of the input and using that as a randomizing device. Just do a straight random pick out of all of your lines of spam-quotes. It will work as good and none will be the wiser.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In reply to Re: will this random-text script work? how do i integrate a template?
by CountZero
in thread will this random-text script work? how do i integrate a template?
by hawthorne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |