so now I am wondering about whether there exists a non-mess alternative to quick-and-dirty php (not to the full-blown drupal-joomla-mvc-etc web framework alternative).
Indeed there are such alternatives. I would suggest that you take a look at one of the lightweight CGI wrappers (CGI::Lite, CGI::Minimal, CGI::Simple, etc.) add FCGI if you want persistence and then use something like Template to handle the display of the results in HTML. This can be straightforward, with nowhere near the learning curve of some of the heavy frameworks and yet provides better security than putting your code inside the documents. You can still do this with Embperl (which does appear to be alive and well) instead if you prefer.
There are so many ways to approach this sort of task in Perl, but really only one in PHP. That's part of the joy of Perl - welcome to our world.