I'd say the reason for the error is that there is no "prev" statement in Perl. You might want to give a more detailed description of what you want to do, so people can help you find a solution for your problem.
Ordinary morality is for ordinary people. -- Aleister Crowley