php vs. perl

ok. Here’s a quick (or not so quick :)) question.

What is the difference between php and perl. No… I’m not that stupid, i understand that they are two different languages, but both have c like syntax and from what i tell, can do pretty much the same thing. I’m learning php right now, and will most likley learn perl soon, but i just wanted to know what the pros and cons of each are. Thanks :slight_smile:

Just give those both up and learn Pascal.
Someone once said Pascal will solve all the programming problems of the future

*Originally posted by Gadget470 *
**Just give those both up and learn Pascal.
Someone once said Pascal will solve all the programming problems of the future **

For the web?? - If so, it as least isn’t what’s big right now :slight_smile:
— Could someone answer my question though?

Well it isn’t as simple as that. :wink:

PHP is nearly as feature packed, and can do just about everything Perl can do. It is much simpler and easier to use, but it isn’t as capable as Perl.

I started using Perl, and well, I just really enjoy PHP much more.

*Originally posted by AJ Quick *
**Well it isn’t as simple as that. :wink:

PHP is nearly as feature packed, and can do just about everything Perl can do. It is much simpler and easier to use, but it isn’t as capible as Perl.

I started using Perl, and well, I just really enjoy PHP much more. **

could you expand on the ‘capible’ part? Do you mean that it doesn’t run code as fast or what? I must say that i find php very easy and i’ll continue to use it. Just wanted to know if i should look into perl also.

Brandon, i remember you saying that the CD header was made in perl. Could you have done the same thing in php? - If so, why in perl?

Thanks

*Originally posted by AJ Quick *
**I started using Perl, and well, I just really enjoy PHP much more. **

Ditto.

*Originally posted by Jack *
Brandon, i remember you saying that the CD header was made in perl. Could you have done the same thing in php? - If so, why in perl?

Our older server (before moving to Ventures Online) didn’t have PHP installed. They did have Perl, though, so I wrote everything in Perl (forums, header, who-am-i, white papers, etc) You are correct – you can do the same thing with PHP, and the header for the forums is in PHP. The header on the Alumni, Competition, History, and a few pages is still in Perl. One day I may change it around. Not right now though :slight_smile:

I prefer PHP over Perl, only because i use PHP all day at work, and there are a few subtle differences that would drive me crazy moving back & fourth between languages.

*Originally posted by Jack *
could you expand on the ‘capible’ part? Do you mean that it doesn’t run code as fast or what? I must say that i find php very easy and i’ll continue to use it. Just wanted to know if i should look into perl also.

Capable, not capible… :wink:

Well it is basically more down to ease of use, they both can do pretty much the same thing, it is just which one can do it in the shortest amount of space (code).

PHP does probably run faster than Perl, which is one reason why many will choose it over the other. I say don’t waste your time in Perl, unless you just can’t figure out how to do something in PHP. Also, if you are wanting to get into web programming, then it wouldn’t hurt to know more perl, but I say don’t worry about it.

Posted By Brandon Martus
I prefer PHP over Perl, only because i use PHP all day at work, and there are a few subtle differences that would drive me crazy moving back & fourth between languages.

I agree, the differences are very small, but would make you go crazy. I seriously hardly remember Perl, I just phased it all out…

The eternal question of “Perl vs. PHP” has been going on forever, and ever…

http://www.google.com/search?q="php+vs+perl"%2C+"perl+vs.+PHP

K I’m not that bright of a person when it comes to web programming. After reding this web though I see that PHP is well liked and is used throughout this website design and creation.

My qustion is People use PHP and Pearl and PASCAL to do like web work, does this mean HTML is no longer used in writing a webpage or am i looking at all this the wrong way.

HTML is literally required (unless using some languages) to make a site work. Don’t even bother with programming languages if you don’t have HTML down. Perl, and PHP are known as server-side scripts, you still need the HTML to communicate with the webbrowser. In PHP code would look like this:


<html>
<head>
<title>Hi</title>
</head>

<body>

<?php
echo "Hello World!";
?>

</body>
</html>

This would produce a blank page with just “Hello World!” written. Everything is HTML in that example, except for the things inside the PHP tags. You need HTML to do this kind of scripting… I haven’t worked with Pascal so I don’t know about that, but it is the same for Perl, and ASP.

My qustion is People use PHP and Pearl and PASCAL to do like web work

Pascal isn’t for web work, I was joking in my post. Pascal was for database programming and was the precursor to BASIC (Which is pretty much a streamlined Pascal with a few less features). Sorry for being misleading.

And on the PHP/Perl vs HTML, AJ’s post is right, but some pages (mostly the freebies) are entirely in HTML. Also, Macromedia Flash is becoming a bigger part of web programming. Most pages that you see will be geocities.com/MyNeatPages50230/ or the like.

my $.02 -

There are three things (in my option) that make a good web page.

HTML - This handles what the site looks like. Makes it pretty and such thought style sheets and stuff like that. Also, any ‘static’ (or non-changing) stuff for the page will be here. File extentions: *.html *.htm - BTW: XML or xhtml or dhtml are all ‘new’ html like code. The problem with current html is that all browsers display the code differently. So… a web developer is forced to decide how much to rely on ‘eye-candy’ when some browsers won’t support it. This all stems from the problem that back when (Al Gore built the web j/k :)) the web began, the people that designed some of the first code never thought that the web would be used for what it is today. (IE: They thought it would be a text type network thing that schools/goverments would use to share data. NOT, where every person in the us would be viewing it with tons of graphics and ‘eye-candy’)

Client-side scripting - This is mostly JavaScript (JS). This will allow the client (or computer viewing the site) to run some script (or program :)) to do a task. Example: (I’m using this because i see it right now) When you go to post a message on CD, it will run some checks using JS to see if you have enough or too much info. Some JS will check to see if you have a subject (in a new post) or some text in the post/reply box. Also, the vB code inserts the tags using JS. Main point: Client-side scripting is done on the computer viewing the site.

Server-side scripting - PHP, Perl, ASP This is a script (or code) that runs on the server BEFORE it is sent out to the client. This allows web developers to have ‘dynamic’ (or changing) data among other things. CD uses it because this way people can put up data, and others can view it and such. It is also used with on-line ‘shoping carts’ (with SSL (a secure connection)) and other things that require data to change. The advantage to this is because otherwise, the user would have to download ALL of the data and then have their client side scripting do all the sorting/other work. Not a good idea :slight_smile:

Hope this helped all. (PS: Learning computer programming is easy :slight_smile: - I didn’t know php 3 months ago, and now i’m writing a major mod using it for my site :)) - HTML is also very easy. It has a simple syntax. However, when you want to start to have cool looking things, then it gets a little harder with CSS and things like that)

Jack

BTW: Flash is also becoming big. However, flash is just a type of animation that is integrated into websites. Not really a programming language.

Well said, Jack. I just have one thing to add.

*Originally posted by Jack *
Client-side scripting is done on the computer viewing the site.

Don’t 100% rely on client-side scripting for important restrictions & data verification. It’s nice to have it on the client side to catch any mistakes before the data is sent – but make sure you check the data when it gets to the server as well. People can bypass any type of javascript & validation on their end.

*Originally posted by Brandon Martus *
**Well said, Jack. I just have one thing to add.

Don’t 100% rely on client-side scripting for important restrictions & data verification. It’s nice to have it on the client side to catch any mistakes before the data is sent – but make sure you check the data when it gets to the server as well. People can bypass any type of javascript & validation on their end. **

You bet ya. All I use JS for is pretty things or… to tell someone they have an error. It all must be checked again on the server. I’d hate to think of a world where all validation was done on the client.

Hmmm… Ahh… I think i’ll be an admin today (tells the client to the server) :slight_smile:

I learned PERL, then did PHP and liked PHP MUCH better for these reasons:

The code is much cleaner and easier to write. PERL is well known for being an incredibly ugly language with all its symbols strewn all over.

PHP has much better documentation. Goto their website and search for something you need (like “date” or “sort”) and you will find the function with full documentation.

Sure PERL has many more capabilities and there are thousands of modules you can download, but a lot of the things PERL has that PHP doesn’t don’t really benefit people who are trying to write web scripts with it. On the other hand, PHP has a lot of nifty built in stuff that if you are feeling brave you can play around with such as image generation or flash movie generation.

I really have no idea which is faster but I don’t care either. PHP is just so much easier to write.

Giving my own opinion I prefer Perl over PHP any day. Although it is true that PHP was made specifically for web programming I find PERL easier to use. Someone mentioned it is ugly and it may be true but its probably because there are so many ways to do something. You can do thing the way you want or perhaps another. There is indeed a great multitude of modules for perl that do all sorts of crazy stuff. Since perl wasn’t specifically made for web programming most of these modules have not much to do with web programming but the power is there in case one needs to use it. But also because of the same reason Perl may integrate better with other things that may be present on a web server. For example currently for the site I am making I have an option of checking its syntax with a script called “weblint” which runs on a command prompt. But in Perl its pretty easy to run weblint on the webserver, send in some html to it and read its output and then one can display the html with the information weblint provided. PHP probably can do this too in some odd way but I doubt it has as much support for such things as Perl does.

As for Flash, it can also be used for some web programming. Using action-script (Flash’s scripting language) one can do some stuff although not as simply as in Perl or PHP.

I forgot to mention that if you learn Perl you can use it for just about anything unless speed is a real issue in which case C should be used.

*Originally posted by piotrm *
** For example currently for the site I am making I have an option of checking its syntax with a script called “weblint” which runs on a command prompt. But in Perl its pretty easy to run weblint on the webserver, send in some html to it and read its output and then one can display the html with the information weblint provided. PHP probably can do this too in some odd way but I doubt it has as much support for such things as Perl does. **

http://www.php.net/manual/en/features.commandline.php

a syntax checker, based on (or using) ‘lint’, is built into php

bash-2.05$ php -l blah.php 
<br />
<b>Parse error</b>:  parse error, expecting `','' or `';'' in <b>/home/chiefdel/blah.php</b> on line <b>4</b><br />
Errors parsing blah.php

I’d say that Perl rocks! … but not in the web development area. I like perl because it is easy to do almost anything with perl. It has powerful regular expresions and has great file handling ablilities. Even though it has a DBI module for database connectivity, PHP is the king in interacting with Databases. Since web development centers heavily around databases today, PHP will take the crown. It also executes faster than perl (no mod_perl involved) and has a large fanbase. So you can’t go wrong with PHP, but Perl is for old-timers that can’t let go of tradition.

mikeXstudios

the syntax checker i was refering to was to check the html that perl prints out, not the perl itself, i think checking its own language’s syntax is kind of given for just about any language

Just one question. Where would be a good web site to learn PHP scripting.

www.php.net :slight_smile:
www.phpbuilder.com