Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Books Media Programming Book Reviews IT Technology

Beginning Perl, 2nd Ed. 141

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.

Beginning Perl, 2nd Ed.

Comments Filter:
  • Author? Publisher? (Score:1, Insightful)

    by gounthar ( 212393 ) on Wednesday November 24, 2004 @02:58PM (#10911169) Homepage
    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 @03:03PM (#10911202) Homepage
    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.
  • Re:Market Flood (Score:1, Insightful)

    by Saeed al-Sahaf ( 665390 ) on Wednesday November 24, 2004 @03:05PM (#10911216) Homepage
    And besides, Perl is dead, right? Hasn't PHP taken the Perl crown jewels?
  • Re:Hold Crap! (Score:3, Insightful)

    by ackthpt ( 218170 ) * on Wednesday November 24, 2004 @03:12PM (#10911295) Homepage Journal
    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...

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

    by sik0fewl ( 561285 ) <xxdigitalhellxx@ ... m ['hot' in gap]> on Wednesday November 24, 2004 @03:12PM (#10911305) Homepage

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

  • Re:Hold Crap! (Score:5, Insightful)

    by sheriff_p ( 138609 ) on Wednesday November 24, 2004 @03: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
  • Re:Hold Crap! (Score:4, Insightful)

    by skids ( 119237 ) on Wednesday November 24, 2004 @03:15PM (#10911327) Homepage
    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;)
  • Re:Hold Crap! (Score:3, Insightful)

    by TheFlyingGoat ( 161967 ) on Wednesday November 24, 2004 @03:20PM (#10911374) Homepage Journal
    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.
  • Re:Market Flood (Score:5, Insightful)

    by Qzukk ( 229616 ) on Wednesday November 24, 2004 @03:21PM (#10911379) Journal
    More to the point, is there a market for another Beginning Perl 5 book now?

    The End Is Nigh [perl.org].
  • Re:Hold Crap! (Score:1, Insightful)

    by Anonymous Coward on Wednesday November 24, 2004 @03:37PM (#10911552)
    That's the truth. Back in the early 80's we had BASIC and you could dink around and get immediate results. It even used variable names like $firstname, with dollar sign like Perl does. :) If you wanted to be hardcore you could peek & poke, which doesn't really apply anymore these days (kernel won't allow you to access arbitrary memory) but you can still do stuff with Inline::ASM if say you have mmap'd a framebuffer and want to play around with putpixel-type algorithms.
    All in all you could do a lot worse than Perl for a beginner language. I mean, some people start out with Java. *shudder* Somebody I know had the misfortune of sitting through some Java class at uni and it totally turned him off programming.
    And all you elitist motherfuckers who think non-programmers shoudln't code: go eat a dick.
  • Re:Hold Crap! (Score:2, Insightful)

    by Waffle Iron ( 339739 ) on Wednesday November 24, 2004 @03:45PM (#10911612)
    Well, I've had to teach my gf and a couple others some simple things... and just the idea of a "variable" is hard to grasp for some people.

    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.

  • Re:Holy Crap! (Score:2, Insightful)

    by Tumbleweed ( 3706 ) * on Wednesday November 24, 2004 @04:04PM (#10911859)
    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." :)
  • Re:Hold Crap! (Score:2, Insightful)

    by Fahrenheit 450 ( 765492 ) on Wednesday November 24, 2004 @04:44PM (#10912327)
    the required variable prefixes clearly allow newbies to see what's a scalar, array, etc

    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:

    So, given this list: @tune = ( "The", "Star-Spangled", "Banner" ); "The" is in the first position, but you'd access it as $tune[0].

    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 [yale.edu].

  • No prior knowledge (Score:4, Insightful)

    by tootlemonde ( 579170 ) on Wednesday November 24, 2004 @04: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.

  • Re:Market Flood (Score:3, Insightful)

    by 0racle ( 667029 ) on Wednesday November 24, 2004 @05:07PM (#10912558)
    What crown jewels? You mean regex and the vast number of pre-existing modules? I think PHP has a long way to go on both counts. I don't know PHP, I hate Python but I like Perl. However, its the modules that make it so much more usefull to me, and thats the reason I stick with it.
  • Re:Miss Ol' Randal (Score:3, Insightful)

    by qw(name) ( 718245 ) on Wednesday November 24, 2004 @11:07PM (#10915431) Journal

    Randal's books are good ... if you like to hear him tell you how wonderful he is. ;-)

All seems condemned in the long run to approximate a state akin to Gaussian noise. -- James Martin

Working...