Learning Perl, PHP, MySQL
December 17, 2003 11:30 AM   Subscribe

I'm interested in filling out my workday learning perl, php and mysql at my own speed. I have no programming background. Anybody have any good experiences with any online courses, or any other advice? Money is not an object, what is important is good structure (logical progression of concepts) and the ability to get personalized help when needed.
posted by luser to Education (25 answers total) 4 users marked this as a favorite
 
If you have no programming background, you might want to seek out a book or course that's expressly designed to introduce not only a given language but the basics of programming in general. I'm thinking specifically of Elements of Programming With Perl, which I haven't looked at myself but which many people seem to speak highly of.
posted by staggernation at 11:52 AM on December 17, 2003


Learn PHP, then learn SQL, then learn MySQL, and when you get really good at all three, go try and learn perl. If you have zero programming knowledge, perl is not a good language to start with. Trust me, I learned the hard way.
posted by SweetJesus at 11:56 AM on December 17, 2003


I really dig the "Learn in 24 Hours" books... nice, bite sized lessons, each of which can be completed in about an hour. Of course, it helps to have a project and work to find out what you need as you try and complete it.
posted by ph00dz at 12:10 PM on December 17, 2003


Not sure what the protocol for self plugs is here...

That said, I run a community called freedom2operate (http://f2o.org/), the goal of which is to provide the resources necessary for developers to learn a new technology or two that they otherwise wouldn't have had access to. We provide perl, PHP, MySQL as well as other languages/technologies.

Sometimes the biggest hurdle to learning new technologies like PHP or MySQL is finding a place to train in them or trying to configure a computer yourself with the tools you need(which is often an exercise in itself).

Anywho, check out the about us page or a more detailed FAQ. We're launching our first online training session next month as well in PHP. If you're (or anyone else) is interested in signing up just drop me a line. mefi -AT- djc.f2o.org and I'll be happy to set you up and get you acclimated.
posted by djc at 12:10 PM on December 17, 2003


"PERL by Example" is a good book, by Ellie Quigley, who not only goes around teaching PERL, but maintains excellent online supportive material. I had no programming experience either, but her class really got me started with PERL.

BTW - I think your selections of what you want to learn make a lot of sense. The most common mistake I see people make when they want to learn some programming is to jump into unwiedly, difficult stuff like Java, just because it's all they've heard of.
posted by scarabic at 12:47 PM on December 17, 2003


I'd refute that Perl shouldn't be used as a starter language -- the Llama book is a gentle introduction to any kind of programming at all. No matter which languages you pick or in what order, however, start with one and stick with it for a while. Don't try to learn two or three things at once. If you're planning to go it alone and work from a book, do the exercises, no matter how banal or baffling they seem. The time spent simply working with the language, even just typing in listings from the book, is time well spent for a beginner.
posted by majick at 12:49 PM on December 17, 2003


Indeed, do the exercises. You'd be surprised how much you learn just by actually typing the programs out yourself, versus looking at them written out on screen or in a book.
posted by scarabic at 1:06 PM on December 17, 2003


It helps a lot if there's something specific you want to learn how to build. It doesn't have to be something incredibly sophisticated, and even for a small goal it might take you months to get there. But having a project will help you focus on the parts of the language that are actually useful.

The most important skills in programming are knowing how to break down a project into smaller pieces, choose which ones to build first, and then learn what you need to know in order to build them. Trying to do that for a small but tangible result is far more important than getting bogged down in the arcane details of a particular language.
posted by fuzz at 1:09 PM on December 17, 2003


Join O'Reilly's Safari for online access to all kinds of things that will help you learn Perl.

It's like 15$ per month, and totally worth it.
posted by bshort at 1:12 PM on December 17, 2003


Response by poster: Thanks for the ideas, particularly about having a project to do. Are any of these books particularly project-based? Because I don't really have a specific project in mind that I feel confident would be appropriate for my (nascent) beginner's level.

Perhaps someone could suggest a fund/useful project that I might use as a learning exercise? Like the PHP equivalent of building a birdhouse in woodshop?
posted by luser at 1:24 PM on December 17, 2003


You could use PHP and MySQL to build a database of your books (or movies or CDs or whatever you have lots of) and some sort of web interface for reading, updating, etc.

(Or you could have a web site and then get really fed up with Blogger being down all the time and write your own CMS from scratch without knowing anything about PHP other than include() or having heard of MySQL. This will only take you five days or so, but you will need to sleep for three after. It is not recommended.)
posted by fidelity at 1:35 PM on December 17, 2003


Response by poster: Database of CDS -- great timing on that idea, since I'm thinking about taking on the massive project of ripping them all anyway.
posted by luser at 1:42 PM on December 17, 2003


"Database of CDS"

For extra credit, have the script search your hard drive for mp3 and wma files that aren't already in the database.
posted by y6y6y6 at 2:17 PM on December 17, 2003


I'd refute that Perl shouldn't be used as a starter language -- the Llama book is a gentle introduction to any kind of programming at all.

I have been programming for literally half my life. I have coded professionally in at least four different languages and dabbled in twice that many more, not counting ones I learned in school but never used in the real world. The Llama book has resisted my attempts to grok it not once, not twice, but three times. If I were a beginner to programming, rather than a veteran, I cannot imagine how baffled I would be. I must vehemently disagree that Perl is appropriate as a first programming language. More than likely attempting to learn Perl first will put neophytes off programming entirely, not just Perl.

In fact, I would suggest that Perl should not be anyone's programming language at all. Its ubiquity is irritating, because it is impossible to tell what a Perl script is doing by looking at it, yet people regularly give out Perl scripts for as "examples" of how to do things as if such examples were helpful or even comprehensible.

The problem with Perl is simple. Before you can really master a language, you must understand the philosophy behind it -- how its designer intended it to be used, the types of structures and patterns it was designed to support: its overall "flavor," for lack of a better word. Perl, being an ad hoc agglomeration of things that Larry Wall took from other languages because he thought they would be useful, was not designed but grown, and therefore has no philosophy. Thus there are no discernable patterns to the language. Knowing one bit of the language will not particularly help you learn the next bit. Some parts of the language are derived from sed or awk, while others come from C, and some are pulled out of Wall's ass, and there's no way to guess in advance which you're going to be dealing with.

For most programmers, reading others' code is an important means of mastering a language, but with Perl you basically can't read others' code until you've already mastered the language. There are numerous ways to express a given thought in Perl (some mistakenly consider this an advantage) and this leads to each individual developing their own style, which means beginners must be equipped to understand any possible Perl idiom before trying to read others' code. I'm not talking about things like different ways of coding an algorithm but basic syntactical rules, such as the fact that conditionals can go at the beginning or end of a line and can use either "if" or "unless."

Perl also loves terseness and cryptic abbreviations. For example, $_ is the token that means "the current input." WTF? Why? No reason, except that's what Larry Wall made it, obviously without investing any particular thought in the matter. Take a look at this for just a small sample of the ridiculous arbitrariness of Perl's syntax.

My advice: stay away, particularly if you have any aesthetic sense whatsoever.
posted by kindall at 3:54 PM on December 17, 2003


A suggestion: learning both PHP and perl is perhaps redundant, unless you've got a specific reason for wanting to know them both; once you get past the differences in syntax and attitude, there really isn't all that much difference between the two languages. (I'm sure plenty of people will disagree with that statement, so grain of salt and all that... but I think the main reason many people prefer PHP is just that perl looks scary.)

That aside, I'm partial to O'Reilly's Cookbooks" as a reference, though definitely not as your sole source of information). Rather than guiding you through a single large project, they're really good for those quick "I need to do X now; how does that work?" moments. The single-project books will teach you how to build that one project, but can often leave you stuck after that.

O'Reilly is far and away the best publisher, in my opinion; Que and SAMS consciously aim for the bottom of the market (an editor at one of them, probably shouldn't say which, once told me "we publish books for people who don't know any better than to buy our books.") so while they're comforting for beginners, they tend not to be very well indexed or organized.

[on preview]: not to turn this into a Perl versus PHP debate, but Perl was my first language (unless you count BASIC), I learned it mostly by reading other people's code with the llama book in my lap, and I have to say, my first reaction was not "Larry Wall is pulling this out of his ass." More like, "geez, this is a lot easier than it looks." Every language has its quirks and cryptic abbreviations to memorize. YMMV, of course.
posted by ook at 4:08 PM on December 17, 2003


Learn PHP, then learn SQL, then learn MySQL, and when you get really good at all three, go try and learn perl.

This is what I did. I also found some nice people online who were tolerant of initial stupid questions.

A suggestion: learning both PHP and perl is perhaps redundant, unless you've got a specific reason for wanting to know them both.

I use php for web dev stuff because it plays nicer with html. I use perl for quick programs that I run locally (and bigger programs too). I must recommend the manual on php.net as a resouce - I think that it's the only thing on php that I've ever read.

I've got a bunch of perl O'Reilly books (camel, llama, gecko, some others ... it's a zoo, really), too, so I guess I'd recommend those.
posted by iceberg273 at 4:33 PM on December 17, 2003


There's a reason why they call perl "the duct tape of the Internet". Like duct tape, you can use it to fix up anything. But you have to figure out how to do it yourself. Perl teaches you creative improvisation.

PHP is more like an erector set. You can only build a certain type of structure with it, and that structure is built into the language. It's a lot less powerful, but a lot easier to build standard structures. PHP teaches you the basic structure of a Web application, and how to fit the pieces together.

Walk before you run; run before you fly. Start with PHP. Build something trivial that displays a simple page. Then enhance it bit by bit to make a CD database. Then go for extra credit. Then you can go looking for a problem that requires perl.
posted by fuzz at 4:43 PM on December 17, 2003


I must vehemently disagree that Perl is appropriate as a first programming language. More than likely attempting to learn Perl first will put neophytes off programming entirely, not just Perl.

I definitely agree with kindall. I've been a professional programmer for the last dozen years. I am fluent in five languages, acquainted with several more, and I design and build programming languages for a living. I would never recommend perl as a first language. It is inconsistent, cluttered, cryptic, difficult to read, and hard to understand. (Obviously people *can* learn to program using perl, though I suspect that most of the people who actually succeed at it already have experience on a unix command line writing shell scripts.) Someone who starts out learning Perl is likely to have a hard time seeing through the layers of odd added-on features and understanding what is really going on in their program.

PHP is a good place to start. It is a nice friendly scripting language with a syntax that resembles Javascript. You can start out with very simple scripts embedded in your web pages and simply keep making them bigger as you learn more about what you are doing. Eventually you will end up with entire files full of PHP code... but it's an organic process, and you can take it as slowly or as quickly as you feel comfortable.
posted by Mars Saxman at 5:12 PM on December 17, 2003


Perhaps Perl was harder to learn because you'd were familiar with other languages? Perl wasn't my first language, but it was close; I'd had a little C (the most complex thing I ever wrote was a DOS-based Minesweeper clone) and a little MUSHCode (which hardly counts), and I found that Perl came so naturally it wasn't even funny. I've learned it twice, the second time after having not touched it for years, and each time in about a week. While I'm far from brilliant at Perl, I've been able to do the things I need to do in it with no problems.
posted by IshmaelGraves at 5:22 PM on December 17, 2003


There are, for purposes of the discussion at hand, two ends of a spectrum of language types: At one end are languages that impose their sense of order on the programmer, like Java or Pascal. On the far side of the spectrum are languages that the programmer imposes his or her approach on the language, of which Perl is a glowing example (as is something like FORTH). Most languages lie somewhere between these two points, with PHP somewhere towards the latter, Python a ways in the other direction, and so forth.

Picking a language to learn or use for any given project involves finding out a bit about what you need and how you will work, not to mention who you are. A person with a strong preference for one end of the spectrum is typically horrified by the other end of the spectrum. A large group of coders with minimal communication between them needs a language that imposes order implicitly, whereas an individual might find another language somewhere else on this spectrum preferable.

Anecdotally speaking, I was productive within hours of starting out with both Perl and PHP and steadily produced better and better code, but I found coming up to speed with Java to be a long and painful experience because the language refused to understand what I was trying to tell it. I had to go to a lot more effort to express myself in something like Java than I did in Perl, or for that matter PHP. In retrospect, I can say that a part of the pain came from learning Java while working on a pretty skanky, overdesigned codebase chiefly written on a large contract which was billing hourly, but hardly all of it.

In any case, this self-knowledge is incredibly important to choosing what languages to learn and how you will learn them.
posted by majick at 6:50 PM on December 17, 2003


Hardcore multiprocessor C++ & assembler jockey here, just ringing the "not perl first" bell. Perl's amazing, but the learning curve is steep, and unfamiliar code can be pretty impenetrable. It's what's commonly known as a write-only language.
posted by inpHilltr8r at 6:57 PM on December 17, 2003


The Perl-bashing makes me very sad.

I've been programming for 21 years, professionally for 13, and these days, Perl is my first choice for pretty much any project that doesn't require a desktop GUI. Like Ishmael said above, it just hooked into the way my brain worked, and made writing code almost as effortless as thinking about it. You get used to the syntax "quirks", and quickly begin to discover why things are the way they are; it is very much a cobbled together, evolved language, and the tonsils and appendix certainly show, but things are not there for no reason, or just "pulled out of Larry's ass". They're there because they work.

(Another data point: a few years ago, my SO picked up Perl just like that, with exactly zero programming experience, and uses it every day now. I think it's a perfectly fine language for learning to program, or for first-time users.)

If you don't get it, that's fine. But it frustrates me to no end when I see something that I know is perfectly good, and incredibly useful, taking so much flack. My advice: give it a try, stick with it for a bit. If it doesn't click with you, then you might want to consider something like Python or Ruby.

Back to the question: O'Reilly books, of course. If you can afford a conference, you will occasionally find an excellent teacher. Also, I found hanging out on the #perl channel on IRC to be useful at times.
posted by majcher at 8:41 PM on December 17, 2003


You can find some great introductory PHP and MySQL tutorials at DevShed.

They have quite a good range of total-beginner to mid-level examples, starting right from 'hello world' type activities.
posted by backOfYourMind at 3:11 AM on December 18, 2003


Just going to throw one more thing in here, because I never really realized it until reading this thread:

I think, personally, the reason perl came so easily to me is that it's rare that you find yourself completely stuck: since there are fifteen different ways of doing most anything, if the one you're trying isn't working for some reason, you can always try it some other way. It's a good language for people who learn by tinkering.

All the complaints about perl here -- excepting kindall's -- are undeniably true; it's informal and unstructured, and doesn't impose any sort of design philosophy on what you're building. I, personally, tend to see those as advantages, but can certainly understand why those who don't, don't.

Be aware that whichever you wind up adopting, you're going to someday find yourself proselytizing for it on a message board. That, apparently, is a built-in feature of both languages.
posted by ook at 5:24 AM on December 18, 2003


It's a good language for people who learn by tinkering.

Ahh, that probably explains why I never got on with it. I have to understand a feature's context before I am comfortable using it. Perl has tons of features, and there's always some way to do whatever it is you're after, but if you try to really understand why things work and when each variation of the same function is appropriate, it just gets overwhelming. If you are content to just get the program working, maybe perl would be fun.

The other problem I have with perl really has nothing to do with the language itself, but with the way it's used. People take the whole "duct tape" thing seriously, and they don't so much write programs as they strap a bunch of other programs together. So you can only use someone else's perl script if your system is set up like theirs. Every time I download and try to install a perl script, I end up on a wild goose chase where I have to find and install half a dozen or more other modules, utilities, and libraries, and there's inevitably something that just won't compile, and I have to give it up. My success rate at actually getting other people's perl programs to work is about one in ten. At this point I won't even download a program if I can tell it's written in perl, because it's just not worth the frustration.

That, apparently, is a built-in feature of both languages.

Now that is true, and truly funny.
posted by Mars Saxman at 12:57 PM on December 18, 2003


« Older I'm looking for a site (not photo.net) where I can...   |   Moving Overseas Newer »
This thread is closed to new comments.