in reply to Java Code Generation using Perl
Advanced Perl Programming has a good section on "Template-Driven Code Generation" (Chapter 17) that should serve your needs.
Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com
In Section
Seekers of Perl Wisdom