HTML Goodies: Perl Primer: An Introduction
Welcome to the HTML Goodies PERL Primers.
I have been playing around with PERL scripts for a good two years now. I never intended to make the language a part of the HTML Goodies site, but once I put up a small run of CGI tutorials, the email poured in. People want to be able to write, modify, and create their own CGI scripts.
So, I went out and did what most people do. I bought the books. I own seven now by the way. One of the big perks of running a web site is that all programming books are tax deductible. I went through the lessons and got lost. I re-read and got lost. The third time was a charm. It all began to make sense. This is a rough language. It's a mixture of sed, awk, sh and some elements of what looks like C.
I think that if you want to teach people something, you simply must make a point of getting them involved. If you want to teach a person the guitar, you have to get him or her playing songs right away or the student will lose interest. If you want to teach someone chess, you need to get him or her playing games right away or it becomes boring and jumbled.
If you want to get people to learn PERL, you need to give them a useful effect right away.
That's my thinking for these primers. Rather than dragging you through a lot of terms and academic information before getting to the meat of the PERL language, I figured you would be far happier if I gave you an effect right up front.
Right off, you will get a fully functioning script that produces a neat effect. We will then learn more of the PERL language by modifying that script. You will get just a generic look at first, then you'd learn to add text and images, modify the output, write the information elsewhere, keep track of how many times someone came, set up searches, and play with branching. All that time, you will be playing songs rather than just learning notes.
So let's start. Now, after having written all of that, I have to warn you that the first actual working PERL script doesn't come your way until primer number three. Yes, a bummer, I know, but there are a couple of things you simply must know how to do before you can even think about playing around with PERL.
You must be able to:
- Gain access to a server that will allow you place scripts
- Set and change file modifications
There's no way to get around knowing those two elements. Primer One will tell you a brief history of PERL, and then lay out exactly what you need to play with these scripts. I warn you, a lot of servers don't like their patrons playing with PERL. Even my pay-for server disallows it. I have to play with my scripts on either my school server or the Goodies server.
Primer Two will discuss the UNIX modification settings. No, this isn't PERL, but if you're going to play with PERL, you must know how these work.
In Primer Three, you get your first working script, a guestbook script that sends mail and returns a thank you page. You're going to be able to make this thing sing and dance when we get through with it.
I didn't set a number for this set of primers. The reason is that I have no idea how long they will go. I may end up writing 20 or I may write 100, I don't know. That's up to you and your interest in this topic.
[Perl Primer One]