...

View Full Version : What Can Perl Do That PHP Can't?



Dean440
01-02-2010, 09:02 PM
I'm considering learning some Perl to help round out my web development and programming skills. To me, it seems like it's kind of like a middle ground between C, PHP, and shell scripting...I could be way off though. Anyways, I heard Perl makes a good "duct-tape" language. What can Perl do that can't be easily done with other languages?

oracleguy
01-03-2010, 08:49 AM
Well Perl can be used equally well for writing non-web scripts as it can be used on the web. So the bonus is that you can use one language for both activities.

I like using Perl on the web because of it's CGI library. You can write the entire page in Perl using function calls for all the HTML elements. The advantage is the code is cleaner (no mix of static HTML and code that can happen in say PHP) and all your code isn't tied to a specific doctype. Right now I believe the CGI library generates XHTML 1.0 Strict. However in a couple years if they change to HTML 5, all you would have to do is update the CGI library on the server and your site is then done in HTML 5.

FishMonger
01-04-2010, 06:49 AM
I think a better question would be: "I want to accomplish xx task, between Perl and PHP which language would be best?".

Both languages have their strengths and weaknesses. Perl is still the stronger and more developed language. but PHP has grown a lot over the last several years. If you ask a Perl programmer, like me, you will be told that Perl is better, however, if you ask a PHP programmer you will be told that PHP is better.

To answer your question..."What Can Perl Do That PHP Can't?"... you first need to be equally knowlageble and competent in both, which I am not. I have written a couple PHP web sites at work, but I hated every minute of it.

netroact
01-08-2010, 09:46 AM
I asked for a review of PHP in the PHP forum awhile back, and I believe my post was deleted. Nice to know we're more open minded over here.
I have tried both PHP and Perl, and I find that Perl is much much simpler, and definitely a lot more fun.
I am no expert on either language. Just my opinion.

Puffin the Erb
01-08-2010, 09:08 PM
PHP was born out of a few Perl scripts. That said, in my experience each language is capable of doing what the other can do, it's just that one language's method of achieving a particular solution can be faster performing / more reliable / easier to implement / philosophically preferable / more scalable / more flexible / better supported / more secure / shorter ;-) etc than the other's.
So it just comes down to choosing the right tool for the job in hand.

PS
Perl is more poetic than PHP, and inherently more beautiful.

shadowmaniac
01-09-2010, 04:54 PM
Well Perl can be used equally well for writing non-web scripts as it can be used on the web. So the bonus is that you can use one language for both activities.
PHP can be used for non-web scripts as well (PHP CLI (http://www.php-cli.com/)) and if I'm not mistaken, it's been a "default" feature since 5.0 (maybe earlier) albeit far less known and far less used.

netroact
01-09-2010, 07:44 PM
PHP can be used for non-web scripts as well (PHP CLI (http://www.php-cli.com/)) and if I'm not mistaken, it's been a "default" feature since 5.0 (maybe earlier) albeit far less known and far less used.

That's interesting. Wonder why that never caught on like the web interface. I guess probably because PHP was introduced as the perfect marriage to MySql?

cs_student
01-09-2010, 11:38 PM
OP, if you want something which is a middleground for both web-development and general programming, you might want to check out python (http://www.python.org). You can use it as a server side scripting language for web pages. You can also use it to make graphical (as well as command line) applications on the desktop. It also has a very good binding to SDL, called PyGame (http://www.google.com/url?sa=t&source=web&ct=res&cd=1&ved=0CAkQFjAA&url=http%3A%2F%2Fwww.pygame.org%2F&ei=XwRJS4LgNJOmswOI_MDmBw&usg=AFQjCNFktwNAT2qQDUCji_pGzhzRnRCANQ&sig2=4YHTtfbcMlKC9Qmm0c8xXg), which will allow you to create 2d games. There are even openGL bindings to allow you to create 3d games.

However, for a good explanation of each programming language, I suggest you look at the wikipedia pages for PHP (http://en.wikipedia.org/wiki/Php), Perl (http://en.wikipedia.org/wiki/Perl), and Python (http://en.wikipedia.org/wiki/Python_%28programming_language%29).


Regards,

cs_student

oracleguy
01-10-2010, 09:13 AM
That's interesting. Wonder why that never caught on like the web interface. I guess probably because PHP was introduced as the perfect marriage to MySql?

Probably because a lot of the people that build CLI scripts have always used Perl or Python and have a lot of code they have written to draw off of for new programs. Plus the runtimes for both languages are commonly pre-installed in most Linux distros.

Though it does make me curious to try and play around with making a PHP CLI script to see how well it works.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum