Here's a few tips from my experience (re)writing my own forum software (in Perl of course):
- Make sure from the start (one of my mistakes that I'm dealing with right now) that the code is clean, modular, and overall easy to modify. Overall, write the code in a way that makes sense and allows for changing of little details without breaking everything. This means that you shouldn't hardcode lots of stuff. If you use it a lot and it has the slightest chance of changing, put it in some sort of "options file" that can be accessed from any of your other code.
- If you plan on doing something later, or even have an inkling that you might do it, write the code to easily allow for that. For example, in my code, I have a formatter class with a process method that is called on almost all user input/output. By calling the general method and not specific formatting methods, I can easily change how text is formatted by changing that one method.
- And lastly, KISS: Keep It Simple, Stupid. There is a lot to be said for simplicity. While you should plan somewhat in the beginning so you don't end up having to rewrite/modify lots of code, overplanning can be and often is even worse.