Jump to content

Perl vs PHP


stumpy

Recommended Posts

Anyone fluent in both care to say which they prefer and why...I'm pretty good with Perl but sometimes it's hard to incorporate it into webpages. (have found some instances can't do what I wish with virtual includes and xbithack)

Link to comment
Share on other sites

Stumpdog,

 

 

 

I have written lots of both, and they share many syntactic similarities. Both display their C origins proudly, although I do feel that Perl is the more powerful general purpose language 'out-of-the-box'. PHP can be configured to run as a standalone interpreter, but we only use that capability for batch jobs. Please bear with me while I expand on the pros and cons of each, for the benefit of those who may not have encountered either.

 

 

 

My general rule of thumb is : use Perl for command-line work, and PHP for web programming. Perl has a long and distinguished history in the latter domain, but it just cant compare with PHP for outright speed, even with mod-perl.

 

 

 

One of the things I love about Perl is the ready availability of modules for almost every conceivable processing requirement. It remains my language of choice for anything where I have to parse reams of data and do something with the output (sysadmins revel in the language for web logs and similar text files). The downside is that it can be a fairly steep learning curve, and has a reputation for being hard to read after you've written it (or worse, someone else has written it).

 

 

 

After grappling with CGI in Perl/Python or whatever, PHP will seem like a revelation, and it is. We built our corporate intranet completely from scratch using PHP and a PostgreSQL bbackend, and I converted the project team from cynics to believers in less than a week. Granted, we all knew Perl and C, but its not a difficult language to pick up. Check out

 

http://www.phpbuilder.com : great site and some really useful tips.

 

 

 

Stumpdog, it sounds like you would take to PHP like a duck to water : dive in smile.gif

Link to comment
Share on other sites

Good advice.

 

 

 

I had been using Perl for some years when I first tried out PHP. Since then I've been using both. Perl for stuff that runs from cronjobs and the commandline and PHP for webpages (the real selling point on my first project was PHP's SafeMode).

 

 

 

I also use Perl to write daemons (servers that run in the background) that are used from inside PHP pages by making a socket connection.

 

 

 

The languages are similar enough in syntax...

 

 

 

Use both, and preferably under (a) Unix.

 

 

 

Regards,

 

Xenna

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...