Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Comparing Perl & Other Langs

Perl Vs php? Which one is better? by 133tcamel
Posted: 10 Apr 03 (Edited 6 Nov 06)

Perl Vs PHP?
Which one is better?

The simple answer is the former can be better than latter and the latter can be better than former depending on what do you want to use it for. But nonetheless here is a small comparison to help you judge for yourself

But to say the least speaking about PHP, it is something prototyped using Perl, so PHP still uses traces of its Perl ancestry in its many respects. PHP is a younger language, Perl has much more depth and maturity of the code. PHP is even know for bugs in its code (speaking relatively, since perl has been here for a longer time, more time went into correcting them).

Code Integration
The major advantage(most people consider it an advantage) of php is that its code integrates directly with the HTML code, this advantage makes the code much more compact and designer friendly. Perl also offers various solutions like embedperl, mason, Text::Template, but since this is not a part of the core code, it takes some time to get used to this. (On a personal note; I still find it much better to keep the code separate from the template).

Another advantage of php over perl is that php is a relatively easy to learn language and has a smaller learning curve, Perl requires you to have some knowledge of C and some shell scripting. Not that it means you can't learn perl if you don't know these, but should you know these - perl is much easier to learn. Perl's code often appears cryptic to novices but once you get used to seeing it and get upgraded to a perl hacker this gets more and more picturesque (sorry for straying away from the topic, but just couldn't resist :) What I was trying to say was this cryptic looking code is what makes perl more powerful from any other language.. php often gives you long or absurd function names :), so you have to type a lot of unnecessary code which is unlike perl's nifty code..

I haven't benchmarked anything myself, but the simple mantra to perl's any speed related problems is upgrading to mod_perl. Actually I don't even need to test if mod_perl is faster than php since I already know the results (YMMV).

mod_perl has to be enabled server additionally after installing perl. This is a little pain if you're running your scripts on a shared hosting.

Also both perl & php can be made to run with FastCGI for better performance too.

Since perl has been here for so so many years, and so has the CPAN (Comprehensive Perl Archive Network); there is no _other_ thing that even comes near to the CPAN. Any module that can be used for general usage is already available on CPAN. The number of perl enthusiast is also very much, no denying that too. Php also has its mailing lists to offer help. But still the bottom line is that the support available for perl has always remained unparalleled and I think it's going to remain the same.

Debugging perl's code is much easier than php. I know the instant reaction of some people would be to disagree with me, but try running the perl interpreter with the "-Wc" command you'll know what I'm talking about. Also the availability of modules like CGI::Carp and Devel::Messenger can even go to the extent of instant messaging you the code execution status :) nifty, eh?


Both php and perl have been ported on Microsoft Windows and MacOS :)

Note: Features like threading, forking (yeah, I know but thats kinda fake:) not available on Win32 due to the lack of support in windows operating system.

Php is most suited to developing websites. For perl this is just one of the aspects you can specialize in. php has goodies inbuilt for session tracking, etc to make sure that you don't have to do the dirty work in making a website from scratch. Perl too has support for this (CGI.pm, Apache:Session/Authcookie, etc..) but some of these have to be learnt and/or enabled. Where perl wins is that perl can be used in many other fields than just web programming. Perl is also being used in Bioperl, VLSI Perl Scripts, robotics applications, network applications, etc... the list is really endless (one of the reason why I said its like comparing apples and oranges :)

About Me
Written by Sanchit Bhatnagar,
- B.E. Electrical, Delhi College of Engineering (DCE).

I am a freelance developer and I have been programming for about 8 years now. Besides this I've done programming in C, C++, Delphi, Visual C, Pascal, Visual Basic, JavaScript, Qbasic and Assembly8085 (in order of experience). Feel free to use the material presented here for your reference, but do not plagiarize the content, i.e. do not copy text from my articles without giving me credit.

If you have any comments, suggestions, improvements in regards to this, please feel free to send me an email at popularscripts (at) gmail (dot) com

¬ 2003 - Sanchit Bhatnagar.

Back to Perl FAQ Index
Back to Perl Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close