Beginning Perl, 2nd Ed. 141
Beginning Perl (Second Edition) | |
author | James Lee 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. |
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.
Author? Publisher? (Score:1, Insightful)
I'd like to know who wrote it. Thanks for the info.
Re:Author? Publisher? (Score:4, Informative)
According to the ISBN buried in the BN.com link, it's an Apress book by James Lee and Peter Wainwright. See GoPriceIt [ericgiguere.com] for more details. Or just go straight to the Amazon entry [amazon.com] for the book.
EricRe:Author? Publisher? (Score:2, Informative)
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.
Re:Author? Publisher? (Score:1)
James Lee wrote the Second Edition (Score:2)
This article originally showed "James Loo" as the author, and that has now been corrected, so this thread can die now. Lee. Not Loo.
Full Di
Re:Author? Publisher? (Score:1)
Though it appears that Simon Cozen's involvement was limited to having his text from the first edition used and the publisher backtracking on the agreement to pay him royalties for it. [simon-cozens.org]
His first edition is freely downloadable [perl.org] and he has a PayPal tip jar [simon-cozens.org] if you like it.
Smylers
Re:Author? Publisher? (Score:1)
('course, it doesn't excuse the mistake made about not following normal book review form, but hey, we're about solutions here.)
Market Flood (Score:5, Insightful)
Learning Perl (O'Reilly) did an absolutely exquisite job at introducing people to programming and Perl simultaneously.
Re:Market Flood (Score:1, Insightful)
Re:Market Flood (Score:2)
(Sorry, JAPH who tried and dislikes PHP)
Re:Market Flood (Score:3, Insightful)
Re:Market Flood (Score:2)
You think it has a long ways to go, but... You don't know PHP...
Most of the issues people bring up about PHP are wrong.
Re:Market Flood (Score:2)
Re:Market Flood (Score:2)
Re:Market Flood (Score:2)
Re:Market Flood (Score:2)
was there really a market for another beginner's book in Perl?
In a free market -- not to be confused with a GPL market -- this is called competition. Just because there's already a good book out doesn't mean that a better one can't be written. Not to say that this one is better than the other. Also, publishers like to fill in their catalogs with books on all the hot/important/niche topics on the chance that one of them will really fly and to make themselves appear current and relevant to book buyers.
A
Re:Market Flood (Score:2)
Re:Market Flood (Score:2)
Again, I wasn't trying to say that there actually is a need for a new book, or that the new book is better, I was just trying to explain why someone would publish another book on a given topic. I'm sure Larry's book still does well.
EricRe:Market Flood (Score:5, Insightful)
The End Is Nigh [perl.org].
Re:Market Flood (Score:2)
Just because newer languages are out, doesn't mean that C++ is a bad language to learn, for example.
Re:Market Flood (Score:2)
Miss Ol' Randal (Score:3, Informative)
Re:Miss Ol' Randal (Score:3, Insightful)
Randal's books are good
Only a 7? (Score:1, Funny)
Re:Only a 7? (Score:2)
Must be the author.
For those of us who are too cheap.... (Score:5, Informative)
http://www.perlmonks.org/index.pl?node=Tutorials [perlmonks.org]
YMMV of course, and you may very well wind up buying a book anyway, but still check that out!
Re:For those of us who are too cheap.... (Score:1)
Dive into Python [diveintopython.org] - A very good and informative book on python.
Why's (Poignant) Guide to Ruby [poignantguide.net] - If you want to read a free book on ruby, not only is the very informative, buts its an amusing read as well with quite interesting and funny stories to be told alon
Re:For those of us who are too cheap.... (Score:3, Funny)
After that, they can see in what else they already have at their fingertips.
And of course, even non-cheap non-beginners will continue using the rest of perldoc.
sorry, I hate perl. (Score:3, Funny)
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).
Re:sorry, I hate perl. (Score:2)
Any examples? (Score:2)
If you cite examples of your designs or pieces of code of yours, I'm sure I can find some things that could look nicer or be better implemented via Python's OO mechanisms, and I am not just talking about the C++ kind of OO (encapsulation/inheritence/polymorphism) but also about Python's __getattr__ and other powerful features inherent in its OO design).
Re:sorry, I hate perl. (Score:2, Interesting)
And for the record OOP in Perl is NOT bolted on, it is just that Perl is so damn flexable that you can do OOP in man ways. This is a VAST difference.. You can get into the meat of OOP with Perl and not have to depend on what someone's idea of OOP is.
perl6 book coming soon (Score:5, Funny)
Re:perl6 book coming soon (Score:2)
If you go through the book in detail... (Score:4, Funny)
No... What? (Score:1)
I don't understand. What is he talking about?
First Edition's Free (Score:4, Informative)
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 [perl.org].
S2Beginning Perl (Score:2, Funny)
Re:Beginning Perl (Score:1)
Re:Beginning Perl (Score:1)
use warnings;
the latter is prefered above -w switch
Reviewer uses Ruby (Score:1, Informative)
Re:Reviewer uses Ruby (Score:1)
Ruby rules (Score:2)
No prior knowledge (Score:4, Insightful)
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.
Re:No prior knowledge (Score:3, Funny)
Not until Netcraft confirms it.
My intro to perl... (Score:1)
But they ripped of the author of the first edition (Score:2)
This first version of the book was written by Simon Cozens [simon-cozens.org].
When it came to writing the second edition, Simon didn't get the job owing to his reluctance to carry it forward to future revisions, due to work restraints. So, someone else was hired, but Simon was promised 50% royalties, since it was going to be based largely on his work.
Based on Simons latest blog post [simon-cozens.org], the publishers have conveniently forgotten this agreement. He's now not goint to get any royalties for the book, despite having written much o
Re:Hold Crap! (Score:3, Informative)
I learned Perl before any other language and found that the Llama book was a perfect introduction to programming techniques and Perl alike.
Re:Hold Crap! (Score:4, Insightful)
Re:Hold Crap! (Score:2, Interesting)
@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 hav
Re:Hold Crap! (Score:1, Informative)
The reason the [ ] are needed in the original declaration is because they create an array reference. (Much like @{} dereferences). The ARRAY(0xb75eb0) is simply the reference itself.
Additionally, you can access the inner arrays via $b->[0][$var] for direct access. No one I've explained perl too has particular difficulty with these topics.
Warning, Learning Required (Score:2, Informative)
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
Re:Warning, Learning Required (Score:1)
Um, yeah... but we're talking about Perl as a first language here, and the behavior pointed out above is hardly intuitive, and is likely to be a stumbling block for someone just learning how to program. Someone like that is far more likely to understand the concept of a nested list than that of an anonymous array or an array reference.
Re:Warning, Learning Required (Score:1)
I wouldn't expect that someone who lacks programming experience would have any useful basis for intuition. Maybe it's more useful to talk about how consistently and coherently references are in relation to the rest of Perl; I doubt that asking whether they make immediate sense to someone who has just come across them is as useful as it might seem at first.
I also wouldn't expect that someone just learning to program would want to or need to use complex datastructures. In four years and several hundred th
Re:Warning, Learning Required (Score:1)
Perhaps, and after *cough* many years mucking about with computers, I have a hard time putting myself in the shoes of a beginner. However, I could see someone thinking, "Well, I can put a string in an array, and a number in an array, hell, I can put 'em both in the same array. Well, let's stuff a couple of arrays in another array... what the? Why won't this work?"
There might be a good reason for
Re:Warning, Learning Required (Score:1)
I think it's more natural if you already understand context.
Many of the tutorials and beginner books I've read explain context pretty poorly and many gloss over the important differences between arrays and lists. Those are fundamental to Perl as is the type system to ML and its derivatives. It's also a stumbling block.
Re:Warning, Learning Required (Score:1)
The bottom line is that, if I'm trying to teach a 12-year-old how to write a tic-tac-toe program, in Basic or Fortran or C it's basically: DIM BOARD[3][3], BOARD[1][1] = 3, print BOARD[1][1].
In Perl, it's: "Every expression is evaluated in a context, and the value of the expression depends on the context in which it's evaluated. Then I have to explain that precisely (note lack of cogent explanation above -- which limits itself to "because of c
Re:Warning, Learning Required (Score:1)
Does it help to talk about context as it applies linguistically? Native English speakers usually do pretty well at pluralizing nouns, choosing the right pronouns, and making subjects and verbs agree in terms of number. Perl makes it easier because it has no irregular nouns or verbs.
Maybe I'm weird in understanding it that way because I'm a writer (though the linguists in the Perl community have no trouble with it either), but it seems like that explanation ought to clear up almost all of the confusion.
Re:Hold Crap! (Score:2, Insightful)
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
Re:Hold Crap! (Score:1, Interesting)
You're kidding, right? Haskell doesn't have the support base perl does. It doesn't have the documentation that perl does. I found it horribly confusing when I last sank hours of my life into it, and I've got a degree in mathematics, and have been programming professionally since 1991.
Haskell sounded straightforward enough, but looks can be decieving. After writing my first program without a hitch, I spent several hours trying to code a simple p
Re:Hold Crap! (Score:1)
And Latin doesn't have the support base Chinese does. Which is easier to learn? Which teaches you more about other languages?
Haskell sounded straightforward enough, but looks can be decieving. After writing my first program without a hitch, I spent several hours trying to code a simple proof-of-concept Sieve of Erostrathenes in Haskell, and kept getting a bizare "Unification would lead to Infinite Type" error.
Wow... what were you
Re:Hold Crap! (Score:1, Interesting)
Chinese teaches more about eastern languages, latin, about western. Both are documented. Haskell wasn't documented. Undocumented languages are bad.
Wow... what were you doing? Sieve in (idiomatic) Haskell:
sieve
sieve [] = []
sieve (h:t) = h : sieve [x| x
I tried something like that: it didn't work. I tried several variations on syntax, nothing seemed to work, a
Re:Hold Crap! (Score:1)
Chinese teaches you about whatever dialect of Chinese you learned, and I believe a bit about Korean. Latin gives insight into French, Spanish, Italian, and a lot of English, plus a leg up in understanding legal terms, medical terminology, etc. (Although I'm sure some linguist could come around now and point out all of my errors...)
What's rec? What's l? What's h? What's t? What's fun? What's less? What's greater? It's not documented, and
Re:Hold Crap! (Score:2)
Re:Hold Crap! (Score:1)
Re:Hold Crap! (Score:2)
Re:Hold Crap! (Score:1)
When I took Computer Science 101 at MIT, the first thing the proffessor said on day one, was, "If you already know Basic or Fortran please raise your hand."
After waiting for a bunch of students to raise their hands, he continued with, "You people are going to be at a serious disadvantage in this class."
Perl is not a great beginner's language. It's not even an adequate one. Anyone who learns it will learn bad habits that are in opposition to all the principles of goo
Re:Hold Crap! (Score:3, Interesting)
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 ma
Re:Hold Crap! (Score:2, Informative)
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 g
Re:Hold Crap! (Score:3, Insightful)
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...
Re:Hold Crap! (Score:2, Funny)
Re:Hold Crap! (Score:1)
I've worked with a lot of languages - C/C++, Delphi, Java, Perl
finally, someone gets it (Score:2)
Re:Hold Crap! (Score:3, Insightful)
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 f
Re: (Score:2)
Re:Hold Crap! (Score:2, Insightful)
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 v
Re:Hold Crap! (Score:1)
Re:Hold Crap! (Score:2)
Re:Hold Crap! (Score:3, Interesting)
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.
Re:Hold Crap! (Score:1)
Even so, it's hardly an issue...
Re:Hold Crap! (Score:1)
Re:Hold Crap! (Score:5, Insightful)
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
Re:Hold Crap! (Score:1, Insightful)
All in all you could do a lot wo
Re:Hold Crap! (Score:5, Interesting)
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
Re:Hold Crap! (Score:2)
PHP lets you do useful stuff without the slop. It also has documentation which is better suited for a person who doesn't know the language.
Perl has a lot of history behind it... which if you don't know the history, you're SOL. I mean stuff like if you're trying to use a library, you'll have to know an awful lot about what the author did. Toss an object to a person who's never heard of objects, or show some cryptic bit twiddling or make them troubleshoot some random Perl guy's overzealous use of regular
Re:Hold Crap! (Score:4, Funny)
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.
Re:Hold Crap! (Score:2)
In any other sense it is not.
Re:Hold Crap! (Score:2)
Those three are redundant: pick one, either Python or Ruby (Perl is a mess IMHO)..
As for Lisp, I don't know: it could also be Haskell, OCaml, Scheme, Erlang.. Choosing one is difficult!
Re:Hold Crap! (Score:2)
It allows programming to be FUN.
A succinct case [perl.com] for Perl as a first language is made by Simon Cozens, one of the co-authors of the book:
The
Re:Hold Crap! (Score:1)
Re:Hold Crap! (Score:2)
What? There is no split or join in Java?? I know there isn't in Visual Basic or VBA, but then, what do you expect from VB* anyway...
But Java, and even javascript, I would have thought to be a little more programmer-friendly.
Well, I see there are still many good reasons to stay with Perl...
Re:Hold Crap! (Score:1)
It's crackers to slip a rozzer the dropsy in snide.
Re:Hold Crap! (Score:3, Insightful)
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 wit
Re: (Score:2)
Re:Hold Crap! (Score:1)
Agreed. Python is the way to go for a newb.
Re:Holy Crap! (Score:2, Insightful)
Remember the quote, "Perl is Internet Yiddish."
Re:Hold Crap! (Score:1)
But my biggest complain is that perl allows you do use obscure syntax and invisible variables. You end up with poeple writing code completly unreadable that you have to maintain.
I'll avoid talking about using CPAN, now I try to get the modules I need using apt-get.
Re:Hold Crap! (Score:1)
Re:Hold Crap! (Score:2)
Re:Hold Crap! (Score:1)
I suppose when you are misunderstood in English, you can just moan on about the recipient being too stupid to understand, rather than god forbid, you didn't bother to articulate properly.
On the otherhand, if you are misunderstood when coding, you won't get the results you hope for.
So, expression of ideas is massively important, but to say that it isn't important that those ideas are understood seems to make the expression pointless.