Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Beginning Perl, 2nd Ed.

Posted by timothy on Wed Nov 24, 2004 01:50 PM
from the string-them-together dept.
James Edward Gray II writes "Beginning Perl (Second Edition) is a well named text that starts exactly where it claims. It assumes no prior knowledge of Perl or of programming in general. If that describes your needs, this book is a fine place to start." Read on for the rest of Gray's review.
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.

This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • Author? Publisher? (Score:1, Insightful)

    by gounthar (212393) on Wednesday November 24 2004, @01:58PM (#10911169)
    (http://slashdot.org/)
    Looks like somebody screwed his editing job again...
    I'd like to know who wrote it. Thanks for the info.
  • Market Flood (Score:5, Insightful)

    by strider5 (15284) on Wednesday November 24 2004, @02:03PM (#10911202)
    (http://www.fatbrain.com)
    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.
  • Miss Ol' Randal (Score:3, Informative)

    by ackthpt (218170) * on Wednesday November 24 2004, @02:07PM (#10911239)
    (http://www.dragonswest.com/ | Last Journal: Monday November 05, @07:35PM)
    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. :-\
  • Only a 7? (Score:1, Funny)

    by Anonymous Coward on Wednesday November 24 2004, @02:08PM (#10911250)
    Only a 7/10 score? What did the author ever do to you to deserve such a cutting insult? He must have had to kill your cat, steal your girlfriend, or erase your SNES emulator saved-game directory! Possibly he even put the toilet seat down at your house, causing you to accidentally leave a few pee drops on the seat when you took a midnight piss while tired and bleary-eyed. I can't say. I honestly can't imagine what it would take to send a man over the edge and only give a 7 for such an excellent book.
    • Re:Only a 7? by qw(name) (Score:2) Wednesday November 24 2004, @10:38PM
  • For those of us who are too cheap.... (Score:5, Informative)

    by Dr. Mortimer (461903) on Wednesday November 24 2004, @02:09PM (#10911262)
    (http://www.cs.cmu.edu/)
    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 [perlmonks.org]

    YMMV of course, and you may very well wind up buying a book anyway, but still check that out!
  • sorry, I hate perl. (Score:3, Funny)

    by grub (11606) <slashdot@grub.net> on Wednesday November 24 2004, @02:10PM (#10911276)
    (http://www.grub.net/blog/index.html | Last Journal: Wednesday June 27, @08:48AM)

    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).
  • perl6 book coming soon (Score:5, Funny)

    by OmniVector (569062) <see my homepage> on Wednesday November 24 2004, @02:13PM (#10911306)
    (http://www.otierney.net/)
    don't forget to pick up a copy of the new perl 6 book [otierney.net]!
  • by kclittle (625128) on Wednesday November 24 2004, @02:13PM (#10911308)
    ...carefully doing all the exercises, you can then go back to the first page and see that you have no idea what the first example is trying to do -- it is, after all, Perl. :)

  • No... What? (Score:1)

    by quamaretto (666270) on Wednesday November 24 2004, @02:14PM (#10911314)
    (http://www.quux.info/)
    It assumes no prior knowledge of Perl or of programming in general.

    I don't understand. What is he talking about?

  • First Edition's Free (Score:4, Informative)

    by enilnomi (797821) on Wednesday November 24 2004, @02:20PM (#10911365)

    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].

    S2
  • Beginning Perl (Score:2, Funny)

    by BabyJaysus (808429) on Wednesday November 24 2004, @02:24PM (#10911419)
    #!/usr/bin/perl -w
  • Reviewer uses Ruby (Score:1, Informative)

    by Anonymous Coward on Wednesday November 24 2004, @02:33PM (#10911512)
    The reviewer is a frequent poster to Ruby-talk, an email list devoted to Ruby.
  • Ruby rules (Score:2)

    by gregarican (694358) on Wednesday November 24 2004, @03:43PM (#10912314)
    (http://www.diamondcellar.com/)
    As a beginning programmer I can say that between the handful of popular scripting languages Ruby is hands-down the easiest, most logical one to pick up. Most things just make sense and don't seem like bolted on pieces added on after the fact. I have checked out Perl, Ruby, C++, and Java and acknowledge that there are different tools for different jobs. But for someone starting out I've been 10 times more efficient coding applications in Ruby. Plus what other programming language can you hop on a mailing list and have your question answered in an hour or even join an IRC channel where the language's author is usually listed as being in the channel as well? Offtopic granted, but reading about a beginner's guide for Perl kind of struck a chord with me.
    • 1 reply beneath your current threshold.
  • No prior knowledge (Score:4, Insightful)

    by tootlemonde (579170) on Wednesday November 24 2004, @03:51PM (#10912399)

    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:

    1. Database design
    2. A database application and SQL
    3. An operating system
    4. A web server
    5. cgi
    6. html
    7. version control
    8. documentation

    I also recommend:

    • Debugging Perl: Troubleshooting for Programmers by Martin Brown
    • Perl Medic: Transforming Legacy Code by Peter J. Scott
    • Head First Design Patterns by Elisabeth Freeman, Bert Bates, Kathy Sierra, Eric Freeman

    Also, alert the student that it takes 5 years to become proficient and every 5 years half of what he knows is obsolete.

  • by ShipiboConibo (808524) on Wednesday November 24 2004, @04:20PM (#10912685)
    (http://www.shipiboconibo.com/)
    <?php
    echo "</PERL>\n";
    ?>
  • 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 of the material!

    So, rather than buying the new edition (and supporting a publisher who rips off their authors), you should go read the Creative Commons licensed version of the first edition that Simon has posted here. [perl.org]

  • Re:Hold Crap! (Score:3, Informative)

    by strider5 (15284) on Wednesday November 24 2004, @02:06PM (#10911226)
    (http://www.fatbrain.com)
    I 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.
    [ Parent ]
    • Re:Hold Crap! (Score:4, Insightful)

      by skids (119237) on Wednesday November 24 2004, @02:15PM (#10911327)
      (http://abrij.org/)
      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;)
      [ Parent ]
    • 1 reply beneath your current threshold.
  • Re:Hold Crap! (Score:3, Insightful)

    by ackthpt (218170) * on Wednesday November 24 2004, @02:12PM (#10911295)
    (http://www.dragonswest.com/ | Last Journal: Monday November 05, @07:35PM)
    Maybe it's just me, but I wouldn't recommend Perl if you have no prior programming experience... html, then php maybe....

    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...

    [ Parent ]
    • Re:Hold Crap! by John Bokma (Score:2) Wednesday November 24 2004, @05:02PM
  • Re:Hold Crap! (Score:1)

    by Vulcann (752521) on Wednesday November 24 2004, @02:12PM (#10911301)
    Considering Perl has a "do what I mean" style, has no pointers, has no "real" object-orientedness, has very little structure, and is generally very loose on types, I would argue its perhaps the best tool to begin experimenting with programming.

    I've worked with a lot of languages - C/C++, Delphi, Java, Perl ...but I'd have to say Perl is easily the most "fun" to work with - perhaps thats as good a reason as any to have it as you're first language.
    [ Parent ]
  • 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 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).

    [ Parent ]
    • Re:Hold Crap! by liquidpele (Score:2) Wednesday November 24 2004, @02:17PM
      • Re:Hold Crap! by Waffle Iron (Score:2) Wednesday November 24 2004, @02:45PM
        • Re:Hold Crap! by Fahrenheit 450 (Score:1) Wednesday November 24 2004, @03:09PM
      • Re:Hold Crap! by BlueCodeWarrior (Score:2) Wednesday November 24 2004, @04:37PM
    • Re:Hold Crap! by dTaylorSingletary (Score:3) Wednesday November 24 2004, @02:26PM
      • Re:Hold Crap! by Fahrenheit 450 (Score:1) Wednesday November 24 2004, @04:18PM
      • 1 reply beneath your current threshold.
    • Re:Hold Crap! by pooh666 (Score:1) Wednesday November 24 2004, @05:16PM
  • Re:Hold Crap! (Score:5, Insightful)

    by sheriff_p (138609) on Wednesday November 24 2004, @02:14PM (#10911313)
    HTML? Isn't that a markup language, and not a programming language? How does HTML teach you any programming concepts?

    And then ... PHP. *shudder*. "Like Perl without the toolbox, like C without the speed".

    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
    [ Parent ]
    • Re:Hold Crap! by Anonymous Coward (Score:1) Wednesday November 24 2004, @02:37PM
    • Re:Hold Crap! (Score:5, Interesting)

      by Daniel Dvorkin (106857) * on Wednesday November 24 2004, @02:46PM (#10911618)
      (http://www.sff.net/people/Daniel.Dvorkin | Last Journal: Friday October 12, @01:42PM)
      HTML? Isn't that a markup language, and not a programming language? How does HTML teach you any programming concepts?

      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 ... 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.
      [ Parent ]
      • 1 reply beneath your current threshold.
    • Re:Hold Crap! by Dr. Evil (Score:2) Wednesday November 24 2004, @03:12PM
    • Re:Hold Crap! (Score:4, Funny)

      by Coryoth (254751) on Wednesday November 24 2004, @03:55PM (#10912442)
      (http://jedidiah.stuff.gen.nz/wp/ | Last Journal: Wednesday April 04 2007, @02:51PM)
      (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.
      [ Parent ]
      • Re:Hold Crap! by lachlan76 (Score:2) Thursday November 25 2004, @07:05AM
    • Re:Hold Crap! by renoX (Score:2) Wednesday November 24 2004, @04:35PM
    • Re:Hold Crap! by tootlemonde (Score:2) Wednesday November 24 2004, @04:39PM
    • 2 replies beneath your current threshold.
  • Re:Hold Crap! (Score:1)

    by five18pm (763804) on Wednesday November 24 2004, @02:18PM (#10911349)
    People have cut their teeth in assembly language and C. Perl is much more easy (easy as in getting your job done quickly). Besides, in Perl there are many ways of doing things. If a beginner is not comfortable thinking in one way, he can always choose another. He might end up being a better programmer. Except he might be eternally corrupted by Perl and keep asking for Perlish features in other languages (can I have split and join in Java, please?)
    [ Parent ]
    • Re:Hold Crap! by rduke15 (Score:2) Wednesday November 24 2004, @03:51PM
      • 1 reply beneath your current threshold.
    • Re:Hold Crap! by alw53 (Score:1) Thursday November 25 2004, @12:43AM
    • 1 reply beneath your current threshold.
  • Re:Hold Crap! (Score:3, Insightful)

    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.
    [ Parent ]
    • Re:Hold Crap! by liquidpele (Score:2) Wednesday November 24 2004, @02:27PM
    • 1 reply beneath your current threshold.
  • Re:Hold Crap! (Score:1)

    by pteaxwa (126635) on Wednesday November 24 2004, @02:37PM (#10911553)
    Maybe it's just me, but I wouldn't recommend Perl

    Agreed. Python is the way to go for a newb.
    [ Parent ]
  • Re:Holy Crap! (Score:2, Insightful)

    by Tumbleweed (3706) * on Wednesday November 24 2004, @03:04PM (#10911859)
    (http://tumbleweed.smugmug.com/)
    I think one's first programming language should also be a strongly typed language, else you'll never be able to troubleshoot Perl. It's the same reason why JavaScript shouldn't be your first language.

    Remember the quote, "Perl is Internet Yiddish." :)
    [ Parent ]
  • Re:Hold Crap! (Score:1)

    by sodul (833177) on Wednesday November 24 2004, @03:11PM (#10911936)
    (http://www.odul.com/)
    I do like Perl a lot: it allows me to do many things in just a few lines of code (or a few thousands)...
    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.
    [ Parent ]
    • Re:Hold Crap! by John Bokma (Score:1) Wednesday November 24 2004, @05:06PM
  • Re:Hold Crap! (Score:2)

    by 0racle (667029) on Wednesday November 24 2004, @04:03PM (#10912526)
    Perl was very easy for me to pick up and make usefull. It seems like a very good starting language.
    [ Parent ]
  • Re:Hold Crap! (Score:1)

    by paulkoan (769542) on Wednesday November 24 2004, @07:06PM (#10914284)
    (http://paulkoan.blogspot.com/ | Last Journal: Tuesday July 06 2004, @12:05AM)

    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.

    [ Parent ]
  • 8 replies beneath your current threshold.