in reply to The complicated problem
The code is so bad it must have been translated to Perl from PHP in the first place so just find the original PHP and the job is done.