Hi,
I am a programmer that likes and uses both Perl and PHP. I use PHP for websites and Perl for real programs.
PHP is basically simplified Perl, tailor-made for the Web. Perl is a serious, involved programming language.
For most web apps, PHP really can’t be beat, it’s easy to learn and most Forums/CMS/Blogs and just about everything else is written in PHP. It seems like everyone is learning PHP. PHP is replacing Perl for web apps, but it will never replace Perl for everything, you can write a web program easily in PHP, but you can write a web server easily in Perl.
Web apps is Perl are generally made using mod_perl, an apache module written in C that embeds a Perl interpreter and allows you to write full-fledged apache modules directly in Perl. This isn’t exactly for the faint of heart. But it is an unbeatable way to write serious web apps.
Some facts:
Perl apps using mod_perl are generally as fast or faster than PHP for most things.
PHP was originally written in Perl, as a Perl module.
Perl has a very stable and mature database package called DBI. It provides a database-independant interface.
PHP is missing many features that are considerd vital in a serious language.
PHP’s deliberate lack of advanced features, and the web features that are included in the core language make it very easy to learn and use. You don’t even need to be a programmer to use PHP.
Perl is not harder to read than PHP. In fact, superficially the languages look almost identical.
But if you want to know which is better to use, I say PHP is a better choice for most web apps. If you need something very complex, or something that must do programming tasks that are generally beyond the scope of web apps, use Perl;
If you think you’ll ever need to use the code outside of a web app, use Perl. But basically it’s stupid to ask which is better. PHP is good because lots of web designers know it. Perl is good because it is a seasoned, serious application language. They used it for the Human Genome project fer crissakes.
You can’t judge a language on it’s syntax, but on it’s programming features. You must understand that a programming feature is merely a design pattern that’s built in to the language.
But if you do use Perl, use mod_perl, not CGI. Perl loses out to PHP basically because of the way they interface with Apache. PHP documents just work. But you can’t use Perl without using inefficient CGI, or writing an actual Apache module.