in reply to rand() problems

Hyperiris, if you want to iterate through regex matches in your while condition you'll need to use the /g modifier. Also, using $seed as a variable name for a variable which isn't being used to seed the srand function (but is instead being used as the rand() argument) only adds confusion. Lastly, unless you have need to reproduce results with a given seed (that is, a seed for the srand() function), then you want to call srand() only once prior to the loop (and with recent perl's, you don't really need to call srand() at all).

The reason you are getting the same $rndrslt everytime is that your $edtpost string starts with roll=1, setting $seed to 1, and thus your call to int(rand($seed)) + 1 is always going to return 1. Please see the following documents: rand and srand.