PDA

View Full Version : Perl/PHP/Python


islandguy
03-21-2002, 11:20 PM
I was wondering which would be the most useful/benificial scripting language to start learning on. I have mac os x so they all work.

I would like to learn how to create auto generated pages, and these seem to be among the most popular avalible for mac. so my main questions are what are the advantages/disadvantages for them?

also if any one knows of good tutorials, web sites to help me learn i would be most greatful!

Thanks,
IslandGuy

bakednotfried
03-22-2002, 10:28 AM
wow, you just opened a can of worms ;)

there are two basic responses to this question. the first is to tell you that there is no general correct answer to the question. the other is to tell you that [pick one of (perl|python|php)] is the obvious choice and that the others are just crap.

my take is that they all have their usefulness, and the right one for you depends on a number of factors, including how intuitive the particular language is (to you) and how easy it might be to get help with one versus the others in the circles you travel.

when i first started scripting, i was lucky enough to have one of the authors of _Perl Cookbook_ in the office. guess which one i chose. now, i work with folks who mainly use php so i have moved in that direction.

each one has their own style and it's possible that one may feel more intuitive to you. there are lots of great sites with tutorials to get you started. try something simple in each language and see what you like. after that, a book or two can sometimes be helpful as well.

ultimately, the more tools you have in your belt, the more problems you can solve.

islandguy
03-22-2002, 12:34 PM
I am still curious about some of the advantages and disadvangages of both!

Which is useful for what?

I really apreciate all the feed back i can get!

Thanks,
IslandGuy

Cobalt
03-22-2002, 02:51 PM
One thing to consider is what will be available on the site you host any webpages on. PHP seems to be extremely common and is growing in popularity. Perl requires you to have access to cgi-bin (someone correct me if I'm wrong); many places will let you do that, but some won't.

Your style of programming is another thing to consider. I like PHP because I can mix the PHP and HTML right together in one page (although I'm now learning how useful it can be to separate those functions from each other). To me, Perl seems a bit more "removed" from the HTML and web pages themselves. You may feel the opposite way.

I've seen some interactive websites developed by amateurs for personal use, and the PHP ones generally seem to look and work better. The impression I take from this is that it's easier to do web stuff with PHP than with Perl.

On the other hand, if you're more interested in manipulating text files instead of generating web pages, Perl is almost certainly better.

I haven't actually done much with Perl, and nothing with Python, so take my comments with many grains of salt. :)

Tom

sao
03-22-2002, 11:46 PM
islandguy,

You can check the following tutorials.

Perl :

http://archive.ncsa.uiuc.edu/General/Training/PerlIntro/"

http://www.ebb.org/PickingUpPerl/"

http://www.comp.leeds.ac.uk/Perl/start.html"

http://www.devshed.com/Server_Side/Perl

PHP :

http://www.oreillynet.com/pub/a/mac/2001/07/20/php_macosx.html

http://www.find.com.au/tutorials/webdevelopment/php/default.asp?ct=21&ob=3

http://www.melonfire.com/community/columns/trog/archives.php?category=PHP

http://www.justphukit.com/php-tutorials.php

Python :

http://www.devshed.com/Server_Side/Python


Cheers...

sao
03-23-2002, 12:51 AM
islandguy,

Just a little humor :



Tcl -- It is short (only three letters) and does a suprising amount given that it doesn't have a vowel. It can be pronounced Tickle", which is a command.

Perl -- Bigger and has a vowel. However you'll note that it isn't a common english word; you'll have to know what you're doing to use it, especially with spell-checkers which otherwise complain that it looks like noise.

Python -- This is a Real English Word (honest, look it up!) that happens to refer to a type of snake, which you'll notice is an object. With the two vowels, python is quite readable.


(I picked this up somewhere on the web)


Cheers...

TommyWillB
03-23-2002, 01:21 AM
Most generic Web servers (usually Unix) have Perl. Not all have PHP or Python.

However like Cobalt said, PHP is growing in popularity... expecially among Linux folks...

islandguy
03-23-2002, 02:03 AM
I think I will be looking more into perl for the time being, mainly because of the uses it has outside of web pages.

I think the file manipulating will be very useful and interesting!

still if you have any questions or comments feel free to post them, or email me at

System.out.println("island" + "guy" + "@mac.com");
:D

(i'm in a computer programming class using java, so i figured i'd have fun!)

IslandGuy

Cobalt
03-23-2002, 10:12 AM
IslandGuy, I don't know how familiar you are with regular expressions, but since they constitute a majority (to me at least) of the work in doing file manipulations, I can recommend the O'Reilly book "Mastering Regular Expressions" by Jeff Friedl. It even helped me write a Perl script that extracted a bunch of contact info from a data file that had lots of extra cruft in it.

rudar
03-23-2002, 09:43 PM
Well, for what it's worth, I've been teaching myself both Python and Perl over the past few months, so here's my impressions:

I've heard Perl described as being optimised for jobs that are 90% text processing, and 10% other stuff. Generating html is, in a sense, text processing, if you choose to think of it in those terms

I'm using Python for stuff that's maybe 40% creating GUI's, 20% text processing, and 40% interfaceing with databases. It seems pretty optimal for that. It is (or, leastways, I use it in a way that is) more object oriented. If you choose to think of html in terms of objects, more power to you...

I haven't used PHP much, but (as mentioned above) it seems closer to the html. I'd guess PHP is optimised for jobs that are (/me picks random number from mid-air) 50% generating html, and 50% other stuff. I guess much of the other stuff could well be text processing.

So I guess you could to think about what the majority of the programming time will be spent doing, and pick a language based on that. Or you could do like myself, try to learn both/ all three, and keep getting the minor syntax differences mixed up...

As far as the Python/ Perl advantages/ disadvantages, when I'm in python I get annoyed that I have to type everything out and can't use cryptic shorthands. Then again, I haven't tackled anything near as big in perl, but I could imagine that trying to read through pages of cryptic shorthands would be pretty tough when something ain't working right.

Either way, get O'Reilly's "Learning P***" book; they are incredibly good introductory texts. I have no idea why, but these guys just "get" how to write computer books.

sao
03-26-2002, 06:25 AM
The master's voices :


If Perl weren't around, I'd probably be using Python right now.
Tom Christiansen in comp.lang.perl, 2 Jun 1995


Strangely enough I saw just such a beast at the grocery store last night. Starbucks sells Javachip. (It's ice cream, but that shouldn't be an obstacle for the Java marketing people.)
Jeremy Hylton, 29 Apr 1997


When I originally designed Perl 5's OO, I thought about a lot of this stuff, and chose the explicit object model of Python as being the least confusing. So far I haven't seen a good reason to change my mind on that.
Larry Wall, 27 Feb 1997 on perl5-porters


Things in Python are very clear, but are harder to find than the secrets of wizards. Things in Perl are easy to find, but look like arcane spells to invoke magic.
Mike Meyer, 6 Nov 1997

and a little girl :

A little girl goes into a pet shop and asks for a wabbit.
The shopkeeper looks down at her, smiles and says

"Would you like a lovely fluffy little white rabbit, or a cutesy
wootesly little brown rabbit"

"Actually", says the little girl, "I don't think my python would notice"


Cheers...

phinsman
12-08-2005, 03:28 PM
I think if you're doing strictly web stuff, you should stick with PHP. If you're wanting to mix in some utility scripting, be it for the system or whatever, go with Perl and/or Python (preferably Perl here though...at least I think so). If you want to make some X11 apps, Python is probably best, although again, Perl is great too.

Dale

mnewman
12-08-2005, 08:33 PM
Just as an example of how useful PHP can be: I do a web page for a friend of mine. It is data intensive. At first I had it in plain HTML with the data embedded in the code. The page was nearly 5000 lines long. I decided to learn MySQL and PHP. It didn't take long. Now the data is all in a SQL database and the web page with the PHP code is only 100 lines long.

And, I was able to easily build an admin page that generates add, edit and delete forms so that I've been able to unload all the data maintenance duties on to my friend.

Here's the tutorial I used to learn both MySQL and PHP:

http://dev.mysql.com/tech-resources/articles/ddws/2.html

In this case, PHP happened to be the best tool for the job. But, a jobs might require a different tool.

acme.mail.order
12-09-2005, 07:51 AM
Not that the last two posts aren't relevant, but this thread was last active in March, 2002. That's pushing 4 years ago, or almost time enough for islandguy to get a B.Eng in Computer Science. If he hasn't decided between perl, PHP and Python by now.....

mnewman
12-09-2005, 07:56 AM
Excellent observation.

Note to self: check dates on resurrected threads....

phinsman
12-09-2005, 12:57 PM
Not that the last two posts aren't relevant, but this thread was last active in March, 2002. That's pushing 4 years ago, or almost time enough for islandguy to get a B.Eng in Computer Science. If he hasn't decided between perl, PHP and Python by now.....

Oops...I didn't notice that when I posted. I just like reading through this some times.

Dale