The only real hurdle in switching from php to perl is to wrap your head around the inversion of quoting. php says:
<html>
<body>This is a <?php echo $file_type ?> file
</body>
</html>
perl says:
#!/usr/bin/perl -wT
print qq{<html><body>This is a };
print $file_type;
print qq{ file</body></html>};
Which is of course uglier. php is code embedded in html - in perl it has to be html embedded in code. The answer is, as mentioned, to use templating to turn things back around to a more php-ish perspective. But get used to the idea that the template is *not* your code. It is just a template, which may contain some dynamic variables and perhaps even simple decisions and output switching. But any reasonably complex code that doesn't deal directly with the HTML formatting of the output belongs in the real script which then loads and processes the template.