in reply to The REAL reason for why they choose PHP over Perl.
Why use PHP over Perl for webpage design?
I use to do Perl CGI scripting, but switched to PHP because PHP was designed for webpage use. Originally, PHP was actually a Perl script (which is why both languages look so similar and why learning PHP isn't hard if you know Perl).
However, when I do non-webpage stuff, I still use Perl, and there are many times when I use Perl CGI scripting because the page I'm generating has so little static HTML code in it.
As others pointed out, PHP has a lot of functions for webpage design. It has built in functions to filter out "dangerous" text from HTML code, and there is quite a bit of very popular software built via PHP. (Mantis BT, Joomla, most Blogging software, etc.).
However, once you've stopped working with static webpages, Perl is a much more powerful language. I don't know of anyone who uses PHP for non-webpage tasks even though PHP can be executed directly from the command line.
Part II: Isn't Perl out of date and no one is using it anymore?
I blame the Python people for that one. I think Python people spend more time denigrating Perl than actually coding. Quite venimous stuff. According to them, Perl is impossible to read, it's not object oriented, it has too many operators, it's confusing, etc.
I only worked on Python once, and it was basically putting a few lines in a Python script. I spent three hours on the task: Five minutes of writing the code, and then 2 hours and 55 minutes trying to figure out what Python was whining about.
Seems like I committed the mortal sin of indenting the code with a tab instead of eight spaces. You see, Python uses indents to tell it which lines belong to which blocks of code instead of using curly brackets. A "feature" according to Python people. I haven't touched it since.
I am learning Ruby which is very similar to Python. It is an interesting language, but not that well supported yet. However, Ruby on Rails is something that I believe is going to make a big dent in the PHP coding segment and is something every PHP coder should be learning.
The problem with PHP is that it is extremely difficult to maintain in large sites. Your code is scattered all over the place, and gets hard to trace. Ruby on Rails takes care of this problem by providing a framework where the code and the HTML are separated. Also separated out are all the database functionality.
As a bonus, Ruby (like Perl and Python, but not PHP) is a useful right on the command line. And, unlike Python, it isn't dependent upon the correct whitespacing. My big complaint is that it doesn't use curly braces. Instead, it uses the beginning block's keyword and the word end to mark your blocks, so VI's showmatch mode doesn't work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: The REAL reason for why they choose PHP over Perl.
by Anonymous Monk on Jun 23, 2006 at 17:19 UTC |