dcsimg

Web Automation: PHP vs. Perl vs. PHP Page 3

By Matthew Keller (Send Email)
Posted Jul 7, 2000


PHP is designed to be embedded within Web documents, thus allowing you to do your Web design separate from your application design.

Although Perl can be embedded in HTML documents exactly like PHP (check out Embperl), Perl is not marketed that way, and when most people think of Perl, they don't think of it as such.

PHP vs. Perl: Which is Better?

The answer: "Yes." PHP and Perl are both powerful languages that can make web application programming, automation, and dynamic content a joy to work with. When I plan out a project for a client, or even for myself, I consider both languages. I look at the amount of time I have to do the project. I look at the number of "pages" it will need to generate. I think about who is going to be maintaining this application after I'm done with it (I only maintain a trivial fraction of my applications). I look at the technologies I'll need to interface with. All of these questions help me to decide which language to use for a given project.

Sometimes, I use both! I have several applications that use both PHP and Perl together. Either it was a PHP-based application, but I needed to do something that PHP couldn't do--or I had a Perl-based application that had parts that would be easier to implement in PHP. They are both powerful, wonderful languages, and I enjoy using them interchangeably.

My Perl-Bias

As I mentioned earlier, nine times out of ten, I'll use Perl over PHP. The main reasons for this is familiarity and extensibility. I am very versed in Perl and can write code quickly, easily, and enjoyably in the language. I'm also a big code-resuser, and enjoy writing hordes of Perl modules to do things that I do frequently. My background as a traditional programmer, also makes the "single program with a horde of included modules" scenario very appealing.

Perl and PHP: Period.

Both Perl and PHP are crucial tools for the Web developer. A lot of the best Web-application developers I know pick one of the languages as their strong language, but keep in mind the other for those times when it just makes sense.

I recommend learning them both. The more I spend with either language, the more I like them both. There are times when I'm programming in PHP and go running back to Perl with tears in my eyes, and there are other times when I blow countless hours trying to make a particular "thing" work in Perl, only to find out that the PHP equivalent took about 3 minutes. Don't get into the zeal wars, understand both languages and you'll see where I'm coming from. Both PHP and Perl are wonderful, extraordinary languages.

Matthew Keller specializes in server technologies, with bias towards Linux, Solaris and the Apache Web server. Besides working for SUNY Potsdam, he provides numerous consulting services, has co-authored a couple books about Apache, and even manages to wrestle a mountain every now and then. Visit his personal Web site.

Page 3 of 3


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.