You where right about it being PHP's fault, it looks like by using the include inside a textarea it formatted it incorrectly. Thanks for your help. I solved the problem by simply making the whole application in perl instead of using Perl, it works fine now.