run your program with the perl debugger...and check that you're realy getting a condition that eventually exits out of the recursive subs. if it loops recursively without end, it will crash. comment out the regexes and put in their place some valid static value, to see that the regexes are indeed not causing the crash...i doubt they are.