When I run into problems getting my code to work, I always check that everything works properly with the program directly, outside my code. What happens when you run PAML on your alignment directly, away from your code and BioPerl?