For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > May 2006 > What are the differences between Perl and PHP when handling with









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author What are the differences between Perl and PHP when handling with
Sfantar

2006-05-26, 7:58 am

Hi everyone

What are the differences between Perl and PHP?
Which one is the best to build up a website?
There are more and more PHP-based websites. Except the fact that ISP
provide most of the time PHP/MySQL web hosting, why do people prefer
using PHP instead of Perl?

I would like to create one only using Perl. Consequently, what are the
most used modules for this purpose?
Thanks in advance for your help.

Sfantar

2006-05-26, 6:58 pm

Charles K. Clarkson a écrit :
> sfantar wrote:
>
> : What are the differences between Perl and PHP?
>
> You can Google for that. I found the following article.
> I think perl can be used for more applications than PHP.
>
> http://www.zend.com/zend/art/langdiff.php
>
>
>
> : Which one is the best to build up a website?
>
> You don't really need scripting to build a web site. I
> have used products written in various languages to provide
> complete sites. For example, I just set up a web site using
> Wordpress, a PHP based blog.
>
> In the past, I have used Movable Type, a perl based
> blog. In the latest one I knew I would be doing very
> little modification and the documentation is rich enough
> to allow the end user to manage the site without a big
> learning curve. In the first instance I knew I would
> need to modify some stuff and perl is easier for me to
> grasp.
>
> You can intermix languages on a web site and choose
> the best application for whatever job you are doing. There
> is little reason to restrict your site to only perl or only
> PHP.
>
>
> : There are more and more PHP-based websites. Except the
> : fact that ISP provide most of the time PHP/MySQL web
> : hosting, why do people prefer using PHP instead of Perl?
>
> Why do people like to go to the movies? Why are people
> vegetarians? There are as many answers to your question as
> there are people programming in PHP and perl. And I'm a
> person who prefers perl over PHP, so your question reveals
> at least one fallacy (complex question).
>
> I prefer perl to PHP because I can write better code
> in perl than I can in PHP. Some prefer PHP because they
> can write better code in it than in perl. Many many people
> write code without proficiency in either. To many of us,
> getting the job done, is not good enough. We want to
> churn quality code that is as elegant as it is functional.
> I can do that in perl, but not in PHP.
>
> Your question is like asking an artist why he prefers
> the fat brush to the thin brush. He may not have a
> preference. Or his preference might change with each
> painting, or the phase of the moon, or something
> indescribable. Perhaps he respects others who favor the
> fat brush or perhaps he has more training or history
> invested in the fat brush. Even after you find out why he
> does what he does, you can't apply that answer to all
> artists. His answers are personal. You'll have to
> interview every artist.
>
> I prefer perl over PHP because I can write more
> competent code in perl and because I don't see a need
> (today) to become a more competent PHP programmer.
>
>
> : I would like to create one only using Perl. Consequently,
> : what are the most used modules for this purpose?
>
> If I were building a house, I would not go to the
> hardware store and say, "I'd like to build a house with
> this hammer. What do I do?" Instead I'd go to an architect
> and say, "I'd like to build a house. Can you help me design
> it?"
>
> I look at user experience long before I look at which
> language to program scripts. Create a story board or comic
> book illustrating your typical, or ideal, user's experience
> on your web site and worry about which programming language
> you might prefer down the road.
>
> Build your web site for your web site visitors, not for
> your programming language preference. In sports there is an
> apt saying, "Keep your eye on the ball." Your web site
> visitors are the ball. You are focusing on the wrong object.
>
>
> HTH,
>
> Charles K. Clarkson


You are right. I will look after each of your suggestions.


Sfantar

2006-05-26, 6:58 pm

Chad Perrin a écrit :
> On Fri, May 26, 2006 at 02:17:11PM +0200, sfantar wrote:
>
>
>
> The differences are far too many to list here. However, I'll list a
> few:
>
> Perl tends to run slightly faster. Your site's visitors probably
> won't notice any lag, though.
>
> PHP has a more anemic syntax. For instance, variable types are not
> really differentiated in syntax at all, which can lead to some ugly
> hacks every now and then. On the other hand, a simpler syntax can
> make it easier to do some simple things.
>
> PHP has more core functions (about ten times as many, give or take).
> This is part of the reason it's slower than Perl, in fact. This can
> make the language more accessible to beginners, since "programming"
> with PHP often involves nothing more than looking up the function you
> need to do your job. On the other hand, while there are an ungodly
> number of functions for doing the same tasks in very slightly
> different ways in some cases, in others the functions needed to do
> some very common and simple things are strangely absent, which can be
> frustrating.
>
> The ability to embed PHP directly in code and have the server parse it
> is more commonly available on cheap webhosts than the ability to do
> the same with Perl, though SSI does make up some of the difference.
> Since SSI is even more anemic than PHP, and doesn't really have "core
> functions", this can lead to some juggling to handle insertion of Perl
> output into the page that isn't necessary with PHP -- but if you need
> more than SSI to do it, you probably need to do it in the Perl scripts
> anyway for the sake of good programming practice.
>
> PHP tends to suffer more security issues than Perl. I'm pretty sure
> the function-heavy design of the language contributes to that, but I
> don't know for sure. Good, security-conscious programming techniques
> should allow you to work around such security issues without too much
> trouble, however, so unless you know of specific issues that are not
> acceptable to you, this probably shouldn't make your decision for you.
>
> There are more beginner-level quick-start scripts out there in PHP
> that are easily modified in trivial ways than there are in Perl, from
> what I've seen.
>
> PHP has the potential to teach you a lot of bad habits as a programmer
> if it's the first language you learn -- but it also has the potential
> to be a very easy introduction to programming, perhaps easier than
> Perl if you're going to use either only for web programming to begin
> with.
>
> Perl has some of the most informative programming communities filled
> with some of the most knowledgeable programmers you're likely to find
> on the Internet. I speak of people on this list such as Tom Phoenix
> and Randal Schwartz, and of a pretty big percentage of the population
> at perlmonks.org (I'm constantly surprised by the density of
> programming wisdom there).
>
> Maybe I'm looking in the wrong places, but I just haven't seen as much
> quality of PHP books as Perl books.
>
> Perl is far more fun. Okay, so I'm biased.
>
> Perl regular expressions are much much MUCH better than PHP regular
> expressions. Seriously, working with PHP regular expressions is a bit
> like trying to sort M&Ms with staples in my fingertips. It's not fun.
>
> Despite my bias, I end up using PHP more for web development than PHP.
> This is in large part because for the very simplest tasks, it's just
> easier. I could probably just use SSI and no PHP to do the very
> simple stuff that leads me to use PHP more often than Perl, but
> somehow SSI never occurs to me except when working with Perl.
>
> Perl is useful for a lot more than PHP, generally. If you want to
> learn a language that will prove useful outside of web development,
> you're probably better of with Perl. On the other hand, learning both
> eventually might be a good idea too.
>
> Is this list too long yet? I could go on forever.
>
>
>
>
>
> That depends on what you're going to do with the website. Some website
> development is more easily accomplished in PHP, some in Perl. Sometimes
> factors other than ease of development come into play, too. There's no
> simple answer to that question as you asked it. Regardless of which you
> decide to use, though, you're going to need to know some XHTML, and
> should know some CSS too. Perhaps you should start there, if you don't
> already know these things. There's a reasonably good reference website
> on those topics and more at http://www.w3schools.com that you can use to
> get up to speed. I occasionally refer to it myself, though I know XHTML
> and CSS better than almost anyone I know.
>
>
>
>
>
> It's really really easy to get started writing code in PHP and deploying
> it on a web server. Of course, this is also probably why there's more
> really awful PHP in use on simple websites than really awful Perl: the
> barrier to entry is lower, which means greater accessibility to people
> who don't really know what they're doing. Don't let that stop you,
> though. We all have to start somewhere.
>
>
>
>
>
> Woah, nellie. There's no way to give a meaningful answer to this,
> really. I guess you might say CGI is the most-used module for web
> programming, and that may even be accurate, but it probably won't help
> you much unless it just happens to be the right answer for you by some
> kind of coincidence. It's typically better to come up with a site
> architecture and a plan for how you're going to implement it, then start
> looking for modules to fulfill your needs, rather than to get a list of
> commonly used modules and look for ways to develop your site using them.
>
> As much as it pains me to say it, I think you might be best served to
> start out with PHP, and come back to Perl when you have a bit more of a
> grasp of what you're doing with web programming. I've personally found
> that it seems to work better to start learning Perl for reasons other
> than web programming and to come back to web programming once some more
> general understanding of Perl is gleaned. I ended up learning PHP
> mostly to cover the web programming side of things while using Perl for
> simple system administration tasks and so on, until I got to a point
> where I knew Perl well enough to be able to apply it intelligently to
> web development. Some of this, I'm sure, has to do with the fact that
> the really good resources for Perl tend to be focused on tasks more
> related to systems administration and glue code, while web development
> resources for Perl are often written by people trying to make a fast
> buck who aren't necessarily experts. PHP resources aren't any better,
> but as I pointed out before it's easier to get started with PHP for web
> development if you're coming to it from knowing nothing at all.
>
> Of course, if I wasn't simultaneously learning Perl while learning PHP
> for web development, I'm pretty sure my PHP skills would have
> consistently sucked all along, too. Learning Perl taught me good habits
> that I've been able to apply to PHP. When learning PHP, I recommend you
> also learn another language pretty much at the same time, for some other
> purpose than web programming -- a language with a rich syntax and a very
> good community with very good free resources like PerlMonks. It'll make
> you a better PHP programmer. Perl is particularly suited to this, since
> before PHP was its own programming language, it was just a toolkit for
> web development built using Perl.
>
> That's my take on it. Someone else is sure to have a take that
> completely disagrees.
>


Thank you very much for your long but very very interesting reply.
I started learning Perl. Until now, I think I made the good choice.
Contrary to PHP, It takes some time to deal with Perl at the beginning
but I am very happy to be able to write my first admin scripts by myself.
The cpan.org et perlmonks.org are very helpful websites and so is this
mailing-list ;-)

Sfantar

2006-05-26, 6:58 pm

Thanks a lot for the informations below.
I will look for the modules mentioned below on cpan.org in order to
understand how they work and how to write scripts using them.

Octavian Rasnita a écrit :
> Hi,
>
> PHP is more limited than perl, but much simple to use for simple web pages
> than perl.
> PHP was created specially for making web pages and you can transform very
> easy a .html file into a .php file.
> PHP is better than perl for web sites where there are very few dynamic parts
> of web pages, because those dynamic parts can be inserted in a more simple
> way.
> PHP and Perl can run a program as a CGI script, but it is not recommended to
> run them as CGI scripts but as a web server module and The web hosting
> companies prefer to offer php instead of perl because PHP is more simple to
> use and install as a server module than perl.
>
> Perl is better for more advanced tasks, it is better than PHP because it is
> a little faster, there are much more libraries for perl than for php, and it
> can also be used for creating programs with GUIs for Windows and portable
> programs with GUIs on more OSes.
>
> The web hosting providers also like PHP because it can be set to not provide
> some functions like sending email, or other such restrictions.
>
> For creating web pages with perl there are very many ways that can be
> followed:
> - Use the module CGI only;
> - Use the Module CGI, a templating system like HTML::Template,
> Template-Toolkit or another one;
> - Use mod_perl, the module CGI or Apache::Request, a templating system;
> - Use mod_perl and the module Mason;
> - Use a framework for creating web sites like Catalyst or Maypole;
> - Use a content management system like Krang or others;
>
> ...
>
> Teddy
>
> ----- Original Message -----
> From: "sfantar" <sfantar@laposte.net>
> To: <beginners@perl.org>
> Sent: Friday, May 26, 2006 3:17 PM
> Subject: What are the differences between Perl and PHP when handling with
> Web pages
>
>
>
>
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com