Beginning Perl, 2nd Ed.
Beginning Perl is a conversational-style tutorial that will guide you through your first steps into the Perl world and even a little beyond. The first two-thirds of the book cover the basics of programming with Perl including data types, flow control and IO.
The casual flow through here will help prevent fledgling programmers from suffering information overload. The authors handle the need to provide enough information, though, by revisiting topics repeatedly, going a little deeper each time. Unfortunately, this hurts the volume's use as a reference, as it's quite a challenge to go right to something. (Example: The built-in join() is covered in the chapter on "Regular Expressions," which is certainly not the first place I would look.) The index is decent and can guide you through these problems, if you remember to start there.
In keeping with the book's tone, side-trips and diversions are fairly common. Early on, these center around topics like "How to Think Like a Programmer" and "What Exactly is a Binary Number." I mention this because I know some readers appreciate this level of detail, while the interruptions annoy others. I found many of the discussions insightful, but it did occasionally get carried away with itself. (Example: There is a whole page on Perl's versioning scheme that goes so far as to discuss what a "patch pumpkin" is. Interesting or not, it seems out of place in here.)
One of Beginning Perl's real strengths is its constant encouragement of the programmer in training to experiment as a means of further learning. The text often suggests things to try and each chapter ends with a set of exercises. Answers to exercises are provided in an appendix. The only way to really learn programming is to program, so I was glad to see this push in the right direction.
The final third of the book digs a little deeper, examining references, object oriented programming, the CGI protocol and interfacing with an external database. Make no mistake, these are only introductions, but they are a nice addition to a beginner's book that will have you doing a little practical programming quickly. The "Introduction to CGI" and "Perl and DBI" (database interface) chapters really stood out here.
Two chapters were rocky enough to mention. "Regular Expressions" does not handle its content well, I'm afraid. You spend most of the chapter seeing if a pattern matched, but not what it matched. That's an important distinction for me. Learning regular expressions can be tricky and you need to see exactly what's going on. This issue is finally address near the end of the chapter, but it needed to come sooner. True beginners will likely need considerable experimentation of another book to really catch on to regular expressions.
"Object-Oriented Perl" was also problematic. Frankly the chapter bit off more than it could chew and doesn't really manage to teach much because of it. (Example: Inheritance isn't even addressed.) I think a better use of the chapter would have been to outline only the use of objects as a setup for later chapters, leaving the creation of objects to a volume that could spare the space to do the topic justice. Again, beginners will definitely need more material to be comfortable with object oriented programming.
To summarize, if you've wanted to learn Perl but haven't yet taken the plunge, you could do a lot worse than to start with this book. It's a casual tour of the basics with a few teasers for further study opportunities.
You can purchase Beginning Perl, 2nd Ed. from bn.com. Slashdot welcomes readers' book reviews. To see your own review here, carefully read the book review guidelines, then visit the submission page.
was there really a market for another beginner's book in Perl?
Learning Perl (O'Reilly) did an absolutely exquisite job at introducing people to programming and Perl simultaneously.
"All that glitters is not gold"
According to the ISBN buried in the BN.com link, it's an Apress book by James Lee and Peter Wainwright. See GoPriceIt for more details. Or just go straight to the Amazon entry for the book.
EricI would actually consider Perl to be one of the best starting languages actually (unless you plan on going on to be a professional coder).
I learned Perl before any other language and found that the Llama book was a perfect introduction to programming techniques and Perl alike.
"All that glitters is not gold"
My favorite Perl book was the first one, published by O'Reilly, back in the 90's, by Randal. They've all seemed so dry since. :-\
A feeling of having made the same mistake before: Deja Foobar
There are also a lot of free resources out there to help you learn Perl without having to buy a book. The following website's tutorials listing helped me get started:
http://www.perlmonks.org/index.pl?node=Tutorials
YMMV of course, and you may very well wind up buying a book anyway, but still check that out!
It assumes no prior knowledge of Perl or of programming in general.
Does it mention the need for chicken blood, human tallow candles and pentagrams made from ground baby skull? Sorry, I liked Perl Back In The Day but the OO is just bolted on and I can't do anything with it I can't accomplish with Python (or Ruby although I'm still learning that).
Trolling is a art,
I'd hardly call HTML a programming language...
I'd recommend C, which any decent *nix install should include, then move to perl.
but then I love C...
A feeling of having made the same mistake before: Deja Foobar
I see nothing wrong with learning Perl first (other than the fact I tell everybody they shouldn't touch Perl with a ten-foot pole). Perl was one of the first languages I got into and it's very easy to get started. Sure, there's twenty different ways to do things and things can get really complicated and complex, but if you're just beginning programming you're not gonna be doing the hard stuff.
Using Perl is a good way (as good as anything else) to get accustomed to programming constructs and variables.
As for learning HTML first.. well that's not even a programming language and wouldn't teach you a thing about programming. PHP would be a good one, but you have to know a little HTML first. (Sorry if that's what you meant by HTML, PHP).
I remember when legal used to mean lawful, now it means some kind of loophole. - Leo Kessler
don't forget to pick up a copy of the new perl 6 book!
- tristan
Generally, bash is superior to python in those environments where python is not installed.
HTML? Isn't that a markup language, and not a programming language? How does HTML teach you any programming concepts?
... PHP. *shudder*. "Like Perl without the toolbox, like C without the speed".
And then
You give no reason why you wouldn't recommend Perl as a starting language, so I can't rebutt them. However, I would, for one reason:
It allows programming to be FUN. Ideally, everyone would learn ASM first, then C, then Lisp, then Python, then Perl, then Ruby. But you'll probably have killed most people's desire to program with the first two, and freaked them out with the third.
+Pete
Score:-1, Funny
Perl is a great beginner's language. You don't have to compile it, the required variable prefixes clearly allow newbies to see what's a scalar, array, etc at least until you get into the more complicated dereferencing, and the user can be introduced to the more natural-language forms first, so they don't get parenthesization shock (e.g. $i = 2 unless $this or $that;)
Someone had to do it.
This is a great beginner's book. And if you're a beginner with no cash it's an even better book, since the first edition is available as per-chapter PDFs. Get 'em here.
S2education is no substitute for intelligence
HTML? HTML is a markup language (it's in the name), not a programming language. This is like calling the garbage that Word spits out programming code.
Anyway, it's a good idea for anyone to learn HTML (or even better, XHTML), since it's everywhere now. However, learning php as a first programming language is a bad idea. Don't get me wrong, php is THE language I use for work (a little Perl and C++ on the side), but it won't allow a person to learn any other programming languages any easier.
I started with Pascal, then C++, and later Perl, PHP, and many more. Pascal is actually a VERY good starter language, but doesn't have a whole lot of real-world applications. Perl is a good starting place, but people should learn the "right" way to do it instead of the way it's commonly used. use strict and turn on warnings is the best way to do this. Then Perl is a good starting point and will making learning more complicated languages (C++, Java, etc) or simpler languages (PHP, Basic, Python) much easier.
You have enemies? Good. That means you've stood up for something, sometime in your life. --Winston Churchill
Taken from the top of the slashdot review..
author James Loo with Simon Cozens and Peter Wainwright
pages 429
publisher Apress
rating 7
reviewer James Edward Gray II
ISBN 159059391X
summary A Solid First Perl Tutorial.
#!/usr/bin/perl -w
I think the reason perl was the easiest language for me to grasp from the get-go was because variables were just that
Perl just seems to connect better with me, in that any given variable can be any given thing. A number. A string. An array. A hash. A reference to any of these things. It can even be an object, or subroutine. All things are mutable and transient.
Now if this makes perl a good starting language or not I don't know -- maybe it makes learning other languages harder, because you always with that the other language was more like perl.
At least I do.
d. Taylor Singletary,
reality technician techra.el
I've been programming computers for over 25 years, and sometimes a variable can still be hard to grasp: Is it the data value? Is it the storage slot? Is it a reference to the storage slot? Is it the name of the variable? Is it the binding between the name and storage? Does the value have different names in different scopes? Does the storage slot have a type? Does the value have a type? Is the value mutable? Do I have to manage the storage allocation myself? What are the exact lifetimes of all of the above? In what scopes are they visible? Does it exist in a strange place like a closure?
Some languages expose most all of these concepts to the programmer (Perl is one of them, even though it doesn't usually make you explicitely deal with most of these), and things can get tricky.
HTML? Isn't that a markup language, and not a programming language? How does HTML teach you any programming concepts?
... which was a revelation for me, and for many others. In my case, at least, cobbling together my first pointless, amateurish "this is my homepage hope you like it" Web page led, slowly but quite directly, to a programming career. And I don't think I'm unique in this.
Actually, HTML is a very good thing for people who have never done any programming in their lives to learn, because it does teach what I consider not only a "programming language concept," but the very idea of programming: giving the computer a series of instructions which produce an output noticeably different from the input. This is fundamentally different from the way most people use computers, in which output immediately follows input, and one is obviously a product of the other.
No, HTML isn't Turing-complete, and no, learning it won't teach you any of the theoretical basis of programming. But it will teach you how to write something that can meaningfully be called "code," and let you see the results of your work
The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
Perl's a great beginner's language until you go beyond single-dimensional arrays.
l ).
@b=((0.8,0.9,1),2,3,4);
$b[0] => 0.8
because it flattened out the list for some reason.
Gotta love those at-signs and dollar-signs.
You have to say
@b = ([(0.8, 0.9, 1)], 2, 3, 4);
So the inner list needs brackets.
Why didn't the outer list need brackets?
Then you can say $b[0] and get ARRAY(0xb75eb0).
Well, maybe @b[0] will work, no that gives
ARRAY(0xb75eb0) also.
What you have to say is @($b[0]). Of course, how could I have missed that??
(The preceding cribbed from http://www.garshol.priv.no/download/text/perl.htm
As to compiling, beginner's aren't developers. Perl's ability to chew through bad code makes it *more* educational because you get to see what the bad code did. It also makes it a lot less frustrating when users don't have to pass syntax checks before they even try to run their code. (Developers, on the other hand, can test syntax with commandline switches.)
In Perl, a number is a string and a string is a number. How the value contained in a scalar is interperated is a context matter. So to say Perl makes it hard to tell what is a number and what is a string, is to misunderstand what a perl scalar is.
And as far as security goes, perl doesn't crash its own stack nor will it munge data of nearby variables due to a miscast. I would never trust a newbie coder to write secure code, but then, if I did, it had sure as hell be in a higher level language to avoid buffer overflows.
I like C, too, and I do think using it leads to a better understanding of the actual data manipluations a program performs. But the question is in the merits of teaching programming concepts, and that understanding is only one concept among many. C can't be beat for speed. But when you are learning how to program from scratch, speed is of no concern.
Someone had to do it.
Yeah, but that can be ugly and nonintuitive. For example, in the Perl Cookbook, one of the very first things one reads about arrays is:
Woof... that is ugly to these eyes. And then there's the horrific typing (or lack thereof) issues... Is it really sensible that "Hello" + 2 is a valid value? And is the behavior of something like (3+2) x 4 something that should be clear to a beginner?
Nah... give me something like Haskell as a beginning language. And before anyone starts screaming about monads or I/O, it's possible to introduce them in a gentile, sensible way.
-30-
It assumes no prior knowledge of Perl or of programming in general.
Books that assume no prior knowledge of programming should also give the student an idea of what else they need to know beside programming before they can do any real work.
A partial list would be:
I also recommend:
Also, alert the student that it takes 5 years to become proficient and every 5 years half of what he knows is obsolete.
As the documentation indicates.
Because of context, as the documentation indicates.
You didn't read the documentation. If you had, you'd know that the parentheses don't do anything besides expression grouping. You'd know that arrays can only contain scalars. You'd know how to store a list in a scalar by using an anonymous array or array reference.
You can agree or disagree with that decision, but until you understand context in Perl and its implications, Perl will continue to confuse you.
how to invest, a novice's guide
which is a bad thing, because it means that even their typos don't show up until it actually tries to run that part of the program. So they think they've succeeded, when really they still have a buggy mess.
Well that's not necessrily a compiled vs. interpreted issue. Give 'em an interactive REPL like with Haskell, OCaml, Lisp, Scheme, etc., and that will catch any of the errors that the compiler would catch -- without having to stop and recompile all of the time. Plus, you get type inferencing goodness with the languages like ML and Haskell which make bugs easier to spot, and essentially do away with the need for explicit type annotations.
-30-
(if (parses (your brain) (things that way)) (is (lisp fun)))
To be honest mine doesn't (which is probably why the above is quite wrong), but I do know people who seem to find it far more "natural" and "readable".
Jedidiah.
Craft Beer Programming T-shirts
PHP is a programming language?
Perl Programmer for hire