To be honest I use both PHP *and* Perl. I have to admit that I use PHP where I can though for web scripting, especially database work. And PHP is closely tied to Apache itself though loaded Apache modules (yes similar to mod_perl but I believe with less hassle). Perl on the other hand is great for both CGI/web programming *and* for very powerful OS scripting. Until recently PHP could only be used for web programming but it looks like that is changing. See
http://gtk.php.net/I really like Perl for OS level work but I still like PHP for quick and dirty web programming. Now I know there are a lot of hard-core Python people out there who despise Perl but I've been too lazy to learn Python since Perl has served me so well over the years. I believe PHP is a much easier language to learn than Perl even though it slightly resembles C in syntax. It has a lot of great built in functions that can do a lot of web work with few lines of code. You should try it out and see for yourself. I think PHP and Perl are a great combo.
I think the single biggest thing I like about PHP over Perl for web content is the way you can easily intermix HTML code with PHP code. Your PHP file can be entirely HTML or you can stick PHP functions in the HTML in key places. An example might be a page that you want a drop-down menu containing items from a MySQL/PostgreSQL database. Instead of hardcoding a SELECT tag with several OPTION items, you would just do a loop to select your OPTION items from a database table. Sure you can do that in Perl as well but if you want to cut/paste in a block of static HTML you have to surround it with a "print << (LABEL)" type of statement or surround each line with print statements and escape the "'s and @'s etc, or use the CGI functions. I think PHP has a "cleaner" way of doing this. And yes you can do embedded perl with "embperl" so it comes down to learn both and use both for their strong points. You figure out what each language does better than the other. I am happy as a bug in a rug using either or both.
PHP also has some neat image generation functions where you can build images (such as buttons) dynamically and send out to the browser. Where I used to work I had created a PHP script called "buttonpooper.php". To make sure that everyone who added pages to our intranet site used exactly the same font, color, shape on their buttons they would just go to the Button Pooper web page, type in the text they wanted on their button and it would spit out a button that they could save to their hard drive and add to their web content. I think the entire script took about 5 minutes to write and consisted of about 15-20 lines of code. This is one very simple example.
You should check it out:
http://www.php.netSuggestions on the above link. Click on the "show source" links at the bottom of each page. It's basically a live demonstration of PHP in action. Also browse through the function list. I think you will be pleased with some of the functions available and get an itch to try it out.
And a good developer site:
http://www.phpbuilder.net[ February 26, 2002: Message edited by: VoidMain ]