Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Compare Perl vs PHP

by Ignorance (Monk)
on Jul 06, 2000 at 20:12 UTC ( [id://21325]=perlquestion: print w/replies, xml ) Need Help??

Ignorance has asked for the wisdom of the Perl Monks concerning the following question:

For someone with little or no programming experience, which language is better for learning programming, Perl or PHP?

Secondly, which language is better for web applications?

I understand that I am asking a naturally biased group, but I need to be able to explain(justify) my choice to my boss.

Replies are listed 'Best First'.
Re: Compare Perl vs PHP
by Aighearach (Initiate) on Jul 06, 2000 at 20:48 UTC
    Well, to start with, PHP is very special purpose; that alone means it isn't the best language for learning programming. That said, any language is better than no language. I learned in BASIC, yet somehow I have managed to move on to real programming. ;)

    Perl, OTOH, is very general. You can do pretty much everything with Perl. There are people who claim Perl isn't suited for writing device drivers, but I am finding it perfectly suited for doing bit-level communication with an RS-232 Bill Acceptor interface on an internet kiosk. Perl also handles CGI, databases, graphics manipulation, system administration, data analysis, GUI interfaces, and pretty much whatever else you can think of.

    Perhaps the best reason to learn using Perl, is that Perl uses natural language principles.

    Another reason, is that Perl has available the largest archive of free extentions/tools of all programming languages.

    Another great thing about Perl is the large community of Perl users. This is an incredibly valuable resource; there is no need to take your first steps alone in the darkness.

    For even more reasons, see the Perl page of St. Larry Wall.

    Paris Sinclair    |    4a75737420416e6f74686572
    pariss@efn.org    |    205065726c204861636b6572
    I wear my Geek Code on my finger.
    
Re: Compare Perl vs PHP
by gnat (Beadle) on Jul 07, 2000 at 07:30 UTC
    My experience backs up that of the other responders. I love Perl. It's a great language to learn and know. It's fun, and there are great people behind it. Many of them here.

    Perl will be a more useful language for you to learn in the long run. However, it's bigger and more complex than PHP. PHP is pretty strongly tied to web pages, whereas Perl can make GUI applications, text-based console applications, and more. This might mean that learning PHP will give you a quicker reward if your ultimate goal is to make web pages.

    PHP is a language I use to get a particular kind of job done. That job is integrating databases with web pages. It's very easy to whip up fancy-looking database-backed web pages with PHP because PHP can be embedded in HTML pages and is interpreted in such a way that many common database tasks become very easy. However, as soon as you start wanting to process the data before displaying it, or accessing the filesystem, or running other programs and parsing their output, or sending mail, or ... you're getting into the parts of PHP that aren't its "core strengths" (to put it nicely). At that point I switch to Perl.

    There are Perl systems like HTML::Mason, Template, and EmbPerl that let you mix Perl and HTML in the same page. These all require more setup than simply "compile in mod_php", but can be worth the effort of learning how to configure them. They let you avoid PHP.

    However, there's no real reason to avoid PHP. It's a fallacy that everything has to be done in one language and one language only. If it's easy to do some things in PHP and to use mod_perl for others, then do what's easiest and what makes sense.

    So, my advice: learn both. Which first? Probably PHP because the learnsomething-useit feedback loop is smaller. But do keep your goal of learning Perl in mind, as it'll be far more useful to you in the long run.

    Nat

Re: Compare Perl vs PHP (kudra: php has limited application)
by kudra (Vicar) on Jul 06, 2000 at 20:39 UTC
    There was recently a discussion about this on Not Inciting a Holy War, but.... You could also check out php?. Personally, I use both PHP and Perl, but if I was only going to learn one language, I would pick Perl. PHP has a very limited application.
      Perhaps somewhere on the site we should create a site that holds all of the links that compare Perl and PHP, and Perl and Java, and Perl and COBOL, etc and make it node Perl vs. The World so people can just search for that and get the info they want.
Re: Compare Perl vs PHP
by ferrency (Deacon) on Jul 06, 2000 at 20:48 UTC
    For programming in general, Perl is definitely the winner, due to PHP's limited scope. PHP does have its strong points, when compared to straight CGI Perl (without mod_perl or the like).

    I am not familiar with PHP's performance statistics. But one big win PHP has over Perl is, it's easier for designers to deal with "A little bit of code stuck into my html" than it is for them to deal with finding the HTML embedded in a Perl script (especially one that uses the CGI module instead of big print blocks). This is the problem that HTML::Mason tries to solve. Overall HTML::Mason looks like all the benefits of PHP, except you get to work in Perl instead of PHP.

    If you're trying to work closely with a designer, or trying to teach a non-programmer how to do a few easy scipting things, PHP is probably the answer. In the long run, it's definitely worth learning Perl, and solving designer interface issues with something like HTML::Mason.

Re: Compare Perl vs PHP
by le (Friar) on Jul 07, 2000 at 21:09 UTC
Re: Compare Perl vs PHP
by Maqs (Deacon) on Jul 06, 2000 at 21:32 UTC
    PHP is a great thing for www design, coding and providing access to databases. it is rather simple, nice and not complicated.
    But... All things PHP do could be provided with CGI.pm in perl. You even may think PHP is easier. But, again:
    Want to be web designer/coder - learn PHP. Want to be programmer - learn Perl.

    IMHO :)
    /Maqs.
Re: Compare Perl vs PHP
by JanneVee (Friar) on Jul 06, 2000 at 21:41 UTC
    I base some work on PHP because it is designed to do just for web thingys... But as soon I see that the rows of programming code exceeds the HTML rows. I switch to Perl it is just more suited to handle that kind of generation.

    On the other hand everything is Integrated in PHP. Simple mailforms and easier databasehandling is gold with PHP.

Re: Compare Perl vs PHP
by cwest (Friar) on Jul 06, 2000 at 20:45 UTC
    Perl is much more versitile in the things it can do. Just pick up a copy of Learning Perl and start reading. You will find it an easy language to learn. There is no reason why it can't be your first language.
    --
    Casey
    
Re: Compare Perl vs PHP
by Anonymous Monk on Jul 06, 2000 at 22:58 UTC
    PHP is strictly a web beast (PHP stands for Personal Home Page)whereas Perl is a more general-purpose animal.

    Each has its use. I'm thinking of combining Perl and PHP in one project-- PHP for the front end, Perl for the back.

      No it doesn't. PHP is a recursive acronym that stands for PHP hypertext pre-processor.
RE: Compare Perl vs PHP
by BigJoe (Curate) on Jul 07, 2000 at 00:45 UTC
    I say get very good at programming one general use language (ie. PERL) then grab a book on pretty much any other programming language and you can pick it up quickly.

    --BigJoe

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://21325]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-19 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found