Welcome to WebmasterWorld Guest from 220.127.116.11
PHP is an excellent language for embedding code into HTML, and has built-in support for mySQL. However, I wouldn't really advise using it for big programs because the embedded nature makes it hard to maintain control flow etc.
On the other hand, Perl is also excellent, but you have to generate the whole page, not just parts of it (as you do with PHP). It can also be used for other purposes (e.g., server admin, file processing, etc.)
For myself, I chose PHP 7-years ago because of its ease of use and because I pretty much only do coding for websites.
But perl starts to show its versatility when dealing with large systems that span across several, perhaps hundreds of servers.
As a programmer of both, I have to say that perl is the way to go. It does have a higher learning curve than PHP but once you understand the language you can get MUCH more done in less time than the same amount of aptitude in PHP can accomplish.
The amount of posts in the PHP forum doesn't really indicate anything about PHP being better. To me it seems to show that there are more PHP noobs and there are better places to get help with perl *cough*perlmonks*cough (Sorry Brett).
My Two Cents...
Programing in general is just logic. If you know how to play chess, you can learn to program with ease.
The way I learned perl was to download other peoples scripts and study them, modify them and build something from them. I did not buy a Perl book for 2-3 years, and only then to reference, have never actually read one.
1) I use a CMS written in PHP and I need to modify/extend it. There are a LOT of PHP CMSes around.
2) It has a huge range of functions and almost anything you can wish for is available.
3) It mixes very nicely with HTML
4) On-line documentation is superb
I dislike it because it is ugly. Function names are inconsistent. It is not really dynamic - for example you can not re-define a function (once a function is defined, you can not change it).
I would never use PHP for anything other than web pages.
Incidentally it is not true that you must create entire web pages in Perl - there is an Apache module that allows you to place fragments of Perl within an HTML page - just like PHP.
I have to say I am not that enamoured either language in-itself, but their popularity gives them an edge (e.g. cheap hosting, lots of libraries available, lots of documentation) over what I would consider better languages in themselves (TCL, Ruby).
If you just need a general purpose scripting language that is qucik to learn and don't need prewritten sys admin tools go with php.
When it comes down to it though I can use both equally and prefer php if there isn't something written to do the job already.
I'm a devotee to PHP for websites but I wouldn't think of using it for difficult server work.
I'd say start with PHP, then as your skill and needs grow, start looking at Perl. Learning PHP before you learn Perl will probably make you a better Perl programmer anyway :-)
If you can use frame works like HTML::Mason (r0xx0rs ^^ )or HTML::Template use Perl.
When you use Perl you should be able to install any modul form CPAN.
You do not need "build in" support for xyz. You need the rights to install more modules.
Perl mixes nicely with HTML. (embeded)
Perl is fast.
Perl is easy.
Perl connects easily to almost any DB known to mankind.
You can do almost anything with Perl.
You need to tune the installation of your Server and Apache. Thanks to the cpan shell this is very easy. But you need the rights to do it. ;)
Or in other words:
If I had to deploy a web-application wich should run on every "out of the box" LAMP system via FTP upload I would use PHP.
THIS was the reason for the great success of PHP. But today root/dedicated servers are cheap.
[edited by: Xenon001 at 9:42 am (utc) on Jan. 11, 2006]