Okay that makes sense. Thanks for the quick reply. And I'm totally aware that my script could very well be a security hazard in its earlier stages.
Not being a hardcore programmer and also (admittedly) not being the sharpest apple in the barrel, I don't see why BBcode is so terrible. Even if it is shit, the truth is a lot of people are used to using it. (And yeah, I totally realize if I allowed all HTML tags I'd be screwed!) I don't even know of any forums these days that allow for real HTML; it's generally just disabled.
And why you hate on PHP? I don't know the advantages of PHP over Perl but as far as I can tell it seems like the majority of newer scripts are written in PHP. Why would this be if it sucked so badly?