Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Perl vs. JavaScript vs. PHP

Perl vs. JavaScript vs. PHP
Thread Tools
Mac Elite
Join Date: Sep 2000
Status: Offline
Reply With Quote
Mar 26, 2003, 08:51 PM
 
I'm interested in learning Perl, mainly for creating CGI scripts.

I see many scripts are written in Perl, and I notice that Perl can do a lot in a few lines of code. Perl seems to be a relatively easy to learn and use language.

But a little research has yielded that Perl was not specifically created for Internet applications, so PHP was created to better suit this environment, and it is embedded in the HTML code. I do not know much more about PHP, however.

I know that Javascript is also embedded and seems to be an "easy" language as well. But, I don't think it is as powerful as Perl (from the examples I've seen) and it is a browser functionality, which means it could be interpreted slightly differently or turned off.

Now, I am trying to decide which language I should try to dedicated my efforts to. Any suggestions?
     
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status: Offline
Reply With Quote
Mar 27, 2003, 06:55 AM
 
I'd say either PHP or Perl. Javascript, for the most part, I find I can just look at a reference (book, online) and come up with the code I need. I guess the same can be said for PHP and Perl as well.

I first learned Perl, just because I loved programming in the language. My first websites were buit using straight HTML and Perl CGI scripts to do any 'tasks'. Now, however, I've switched over to PHP. I like PHP because it can be embedded in the HTML and, so far, I've been able to do everything with PHP that I could with Perl.

Both languages are continually progressing. Both have excellent resources (www.php.net www.perlmonks.org). It's a tough choice, but you'll benefit from learning either one.
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Mar 27, 2003, 09:43 AM
 
JavaScript is a client-side language. PHP and Perl are server-side languages.

You say you want to write CGIs. What do you really want to write? Web applications? If so, Perl is the wrong answer.

Perl is a good language for hacking something together, but it's not real big on the software design and maintainability side.

PHP is better than Perl for web applications. Personally, I use Java servlets or Zope for web applications and avoid both PHP and Perl. With Zope, you can put together a powerful site in a few minutes. With Java you can build a scalable, easily maintainable site with good connectivity to any database on earth.

If you're writing true CGIs, use Python CGIs are pretty passe these says though.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Mar 28, 2003, 04:26 AM
 
I second the Java approach to developing web applications. I started with PHP, and its a sound language, but I have now moved to JSP, using JavaBeans and Servlets. Java on the server rules. Look into the JSTL and its Expression Language, it amazing what you can do with a single line of Java code.

I am currently porting all my PHP code to Java. I have gained major speed gains, and greatly reduced my maintainability and scale problems.

Java an be a little more confusing then PHP that make up the J2EE at the start but once you get the big picture its so simple.
     
Mac Elite
Join Date: May 2001
Location: Up north
Status: Offline
Reply With Quote
Mar 30, 2003, 06:43 PM
 
I agree with Arkham_c, Perl is hard to maintain.. and personally, I found it hard to deal with when I was writing a large complicated script (it was the best language for the task though), I would say it was about as hard to learn as C was, even though it looks very much like C.

Perl was designed for stripping stuff from files, and making it easy to make forms out of it, or whatever... it has great pattern matching.
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Mar 31, 2003, 01:54 PM
 
I got the evil eye from project executives when I told them that their Perl/CGI system was antiquated and would not scale right. I still stand by my assessment which was to replace Perl/CGI in favor of a basic J2EE architecture.
The moral of that tidbit is to start with some thing that will deliver the goods in both short and the long term. That truly is the least expensive solution.

My advice is to spend the time learning Java on the server side (especially JSPs and Servlets). It could be rough if you are new to programming but it's a wise investment of your time.

One thing to be careful about is the variety of technologies that tile server side Java -you don't need them all to build good systems.

Stick with JSPs and Sevlets and avoid EJBs, if you are new to programming.
     
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Mar 31, 2003, 06:08 PM
 
Originally posted by Arkham_c:
Personally, I use Java servlets or Zope for web applications and avoid both PHP and Perl. With Zope, you can put together a powerful site in a few minutes.
I'm a huge fan of Zope, but I've migrated all of my code to PHP because I couldn't find any webhosts that speak Zope (or any other web developers, for that matter). Do you know something I don't? Is there some strange enclave of Zope users somewhere that I don't know about?

I love it, but it seems like it's dying.
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
Mar 31, 2003, 07:00 PM
 
Avoid Perl for web applications, this really isn't where its strength is. Perl is great for hacking together some powerful scripts quickly but it doesn't scale well enough for use on the web. I don't think that it's a difficult language to learn, but if you're new to programming then it can look extremely daunting.

If you're not looking at a huge project, you should learn PHP. It's just about the easiest language out there, and you can do some pretty powerful things with even just a basic knowledge.

If you're looking to build a larger system/application, or you want to invest your time in a technology that you can use in a career developing web applications, then you should learn Java and, specifically, JSP and Servlets.

I'm not sure JavaScript does what you are looking for. If you could provide more details regarding the sort of tasks you want to do and your level of experience, then it would be easier to guide you towards the best language.
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Mar 31, 2003, 09:21 PM
 
Originally posted by smeger:
I'm a huge fan of Zope, but I've migrated all of my code to PHP because I couldn't find any webhosts that speak Zope (or any other web developers, for that matter). Do you know something I don't? Is there some strange enclave of Zope users somewhere that I don't know about?

I love it, but it seems like it's dying.
I think Zope is more geared towards intranet use than Internet. I was very involved with Digital Creations (now called Zope Corporation) in the earlier days of Zope. They have quite a bit of business, so I think it's here to stay. I run a Zope server behind apache on my cable modem for my Zope needs.

The new releases (2.6.1) look really good.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Occasionally Quoted
Join Date: Apr 2001
Location: San Francisco
Status: Offline
Reply With Quote
Apr 3, 2003, 01:20 PM
 
.
(Last edited by daimoni; Jul 8, 2004 at 03:09 PM. )
.
     
Gamoe  (op)
Mac Elite
Join Date: Sep 2000
Status: Offline
Reply With Quote
Apr 7, 2003, 12:51 AM
 
Thank you all for your suggestions and comments.

I continue to think that perhaps Perl or PHP is best for the type of thing I'd like to do. I'd like a relatively simple language to learn to "hack" something together with.

I have in mind applications like web address books, mailing lists, bots (a new interest) and the like. But, some of you are telling me to stay away from Perl. So, again, I suppose I'll have to look further into the matter. Java and C(++) seem a bit too complex for me at this time.

Thanks.
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Apr 7, 2003, 05:05 AM
 
Perl and PHP are simpler in some degree then Java to develop with initially.

I felt the same and thus did PHP first. I eventually shifted to Java, and came to understand that Java may be marginally more difficult then PHP and Perl. It is not that much more difficult. And Java is far easier when in comparison to PHP in the Object Orientated stakes.

I now re-great spending time to learn PHP, because, I had to unlearn bad Procedural PHP logic, for the vastly superior Object Orientated Java approach.

You think you are doing it the easy way, but you are just going to have to learn it all offer again when you decide to do bigger and better things, were the likes of Java is King.

Save your Brain: Java is the way. Plus if you ever decide to find a job. Their are far more job for Java then PHP, another reason I no longer both with PHP.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:57 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2