How do Perl and PHP compare?

Discussion in 'Web Design and Development' started by ChrisA, Oct 30, 2008.

  1. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #1
    I don't usually do "web stuff". My background is embedded software, device drivers and so on. But now I need to make an HTML forms based front end to a few command line applications. This will be done with cgi-bin scripts. We don't care about design just as long as it works. There are only about four users so it's very low volume

    I've prototyped some of this using Perl and CGI.pm and I'm impressed with how easy it was but then I've been using Perl from back when it was new.

    OK, now a question: PHP seems to be more in fashion today than Perl for this kind of thing. What's the difference? I've read example PHP code and it looks a lot like Perl. Is there a good reason to use PHP over Perl? If there is I'll use this project as an excuse to learn.
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    If you already know Perl and it can get the job done, then I probably wouldn't worry about PHP. Depending on what you're doing though PHP can offer more speed over Perl, but not in all cases. Both languages have good resources around the web. I know both, about equally well, though still more at the intermediate level. I use both in my web development, though PHP generally for my site, and Perl for back-end things like doing logs and making backups run by cron. So yeah, both are the right tool for the job, it's just a matter of preference at this point.
     
  3. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #3
    PHP is better if you like to produce code that conforms to OO methodologies I would imagine. Although if you are more comfortable with Perl, it is probably best to stick with what you know and get the job done rather than mucking about.

    As long as you (or someone else!) can maintain the code later on easily that is all that matters.
     

Share This Page