Slashdot Mirror


The Perl Cookbook, 2nd Edition

doom writes "For those of you who haven't been paying attention, when the The Perl Cookbook by Tom Christiansen & Nathan Torkington came out in 1999 it immediately became one of the primary references in the perl world. It's one of the first places you should check before making a move with perl, right up there with search.cpan.org, itself. Now we've got the second edition. What's the diff? The diff is 58 new recipes and program examples (list provided below), plus two new chapters on mod_perl and XML (which provide an additional 27)." Read on for doom's complete review. The Perl Cookbook, 2nd Edition author Tom Christiansen & Nathan Torkington pages 927 publisher O' Reilly rating 9 reviewer doom ISBN 0596003137 summary How to do common tasks in perl

The new recipes cover a number of subjects. One of the prominent themes is how to use perl's new unicode support, as well as the new I/O layers feature. The coverage of web programming has definitely been fleshed out with recipes on XML-RPC, SOAP and so on, plus the new chapter on mod_perl. Also of interest of course are the additional recipes on database access with DBI.

The mod_perl chapter is a good succinct introduction, with some very cute recipes in it (though admittedly a lot of these are also covered in the excellent Mod_perl Developer's Cookbook by Young, Lindner and Kobes out from Sams). For example "Transparently Storing Information in URLs" shows how to embed information in any arbitrary position inside a URL. This quickly shows the kind of things you can do with a PerlTransHandler and a PerlFixupHandler. The chapter closes with what looks like a good introduction to "Template Toolkit", which I would probably be very excited about if I wasn't already familiar with the (also discussed) HTML::Mason.

I really enjoyed reading the XML chapter (a subject I'm less familiar with): I predict that you'll find this to be the fastest way through the XALPHABET XSOUP without drowning. For me, this was almost worth the price of the book.

Very little has been removed (hence the page count has gone from 757 to 927), and where I have been able to find a deletion, there are usually very good reasons for it. For example, the first edition takes the trouble to tell us that qr// was introduced in perl 5.005, but the new edition drops the babble about versions there, because for most of us, anything before 5.6 is now ancient history. However, I do miss this particular irrelevant parenthetic aside that's been deleted now:

Remember that the opposite of read is not write but print, although oddly enough, the opposite of sysread actually is syswrite. (split and join are opposites, but there's no speak to match listen, no resurrect for kill, and no curse for bless.)
(p.295, first edition, compare to p.323, second edition.)

In general, it's difficult to think of anything seriously wrong with the Perl Cookbook. I might suggest that in some places they fall into the trap of talking about all the ways to do it, rather than just the best ways, (e.g. recipe 7.5 "Storing Filehandles into Variables" seems a bit complicated).

And maybe there are some slight problems with order of presentation, as with the new perl 5.8 feature of "I/O Layers", which is mentioned a few times before it's finally discussed in the beginning of Chapter 8 (though really, it's amazing that there aren't more problems like this: this is supposed to be reference work, and yet it usually works well as a tutorial also).

I've got one big complaint about the 2nd edition though: they changed the numbering of existing recipes! I've been writing code with comments like

# Schwartzian transform. See Perl Cookbook, recipe 4.15
and now it turns out I should've been specifying an edition number also. Please: "Cookbook" authors, come up with a numbering scheme that remains invariant with new editions... if you can't always just append to the end of the chapter, there's nothing wrong with tacking another dotted decimal on the end. We're programmers, we can handle it.

And speaking of the "Schwartzian transform" that recipe has a very clear, self-explanatory name "Sorting a List by Computable Field", but in the first edition, there was also a footnote explaining that many people call this the Schwartzian Transform, named after Randall Schwartz, who invented the technique. With this second edition, that footnote has been quietly dropped. Guys, if you're going to carry on a feud, this is really not the way to do it. It just makes you look bad.

O'Reilly's perl.com site has a series of articles by the authors, featuring some recipes from the book:

Appendix: New recipes and examples (not including the two new chapters):

  • Using Named Unicode Characters
  • Treating Unicode Combined Characters as Single Characters
  • Canonicalizing Strings with Unicode Combined Characters
  • Treating a Unicode String as Octets
  • Properly Capitalizing a Title or Headline
  • Constant Variables
  • Implementing a Sparse Array
  • Creating a Hash with Immutable Keys or Values
  • Matching Nested Patterns
  • Writing a Subroutine That Takes Filehandles as Built-ins Do
  • Storing Multiple Files in the DATA Area
  • Reading an Entire Line Without Blocking
  • Treating a File as an Array
  • Setting the Default I/O Layers
  • Reading or Writing Unicode from a Filehandle
  • Converting Microsoft Text Files into Unicode
  • Comparing the Contents of Two Files
  • Pretending a String Is a File
  • Working with Symbolic File Permissions Instead of Octal Values
  • Writing a Switch Statement
  • Coping with Circular Data Structures Using Weak References
  • Program: Outlines
  • Overriding a Built-in Function in All Packages
  • Customizing Warnings
  • Writing Extensions in C with Inline::C
  • Cloning Constructors
  • Copy Constructors
  • Saving Query Results to Excel or CSV
  • Escaping Quotes
  • Dealing with Database Errors
  • Repeating Queries Efficiently
  • Building Queries Programmatically
  • Finding the Number of Rows Returned by a Query
  • Using Transactions
  • Viewing Data One Page at a Time
  • Querying a CSV File with SQL
  • Using SQL Without a Database Server
  • Graphing Data
  • Thumbnailing Images
  • Adding Text to an Image
  • Program: graphbox
  • Turning Signals into Fatal Errors
  • Multitasking Server with Threads
  • Writing a Multitasking Server with POE
  • Accessing an LDAP Server
  • Sending Attachments in Mail
  • Extracting Attachments from Mail
  • Writing an XML-RPC Server
  • Writing an XML-RPC Client
  • Writing a SOAP Server
  • Writing a SOAP Client
  • Program: rfrm
  • Using Cookies
  • Fetching Password-Protected Pages
  • Fetching https:// Web Pages
  • Resuming an HTTP GET
  • Parsing HTML
  • Extracting Table Data

You can purchase The Perl Cookbook, 2nd Edition from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

148 comments

  1. same price and free shipping by Anonymous Coward · · Score: 1, Informative
    1. Re:same price and free shipping by Anonymous Coward · · Score: 0

      When Amazon patents book-printing, pricing, and shipping, we will all pay through the teeth.

    2. Re:same price and free shipping by Anonymous Coward · · Score: 0

      AddAll does the work of finding the lowest price.

    3. Re:same price and free shipping by Anonymous Coward · · Score: 0

      don't worry there patent bullshit will more than make up for the difference. I use amazon to shop, BN to buy. course now amazon has ads so I probably will just stop going there.

    4. Re:same price and free shipping by Anonymous Coward · · Score: 0

      but then you're giving addall the commission instead of your fellow /.er

    5. Re:same price and free shipping by Anonymous Coward · · Score: 0

      Your associates account is going to go through the roof! You dog! Spare some my way?
      www.buymylunch.com

    6. Re:same price and free shipping by Anonymous Coward · · Score: 0

      That's fine with me.. I saved $50 on textbooks this quarter using Addall pointing me to bookstores I've never heard of before..

  2. Doesn't work for Perl 6 though... by i_want_you_to_throw_ · · Score: 3, Informative

    The second edition works great for Perl 5.8. but not for Perl 6 which is going to require a rewrite of ALL of the Perl books.

    O'Reilly addresses the issue here

    Still Perl is such a beautiful thing you should buy ALL Perl books.

    1. Re:Doesn't work for Perl 6 though... by jomagam · · Score: 1

      Doood, Perl 6 is still in its design phase. No interpreter yet; of course this cookbook has nothing on it...

    2. Re:Doesn't work for Perl 6 though... by dslbrian · · Score: 1

      ...you should buy ALL Perl books

      But the bookshelf can't take any more! Seriously speaking, my O'Reilly shelf is packed, 15 volumes at work (not just Perl), and I think I have more stashed at home.

      Makes me wonder though if anyone out there has a huge O'Reilly collection. Or does everyone migrate to CDs...

    3. Re:Doesn't work for Perl 6 though... by Anonymous Coward · · Score: 0

      Seriously speaking, my O'Reilly shelf is packed, 15 volumes at work (not just Perl), and I think I have more stashed at home.

      Ha! My bookshelf is longer than yours!

      But don't worry: they say that the length doesn't matter; it's the technique that matters.

      5 inches of perl bookshelf are still bringing more satisfaction than every 8 inch visual basic tome.

    4. Re:Doesn't work for Perl 6 though... by hackstraw · · Score: 1

      Correction:

      Still Perl is such a beautiful thing you should buy ALL O'Reilley Perl books.

      The O'reilley books are excellent. They are written by some of the major coders for perl like Larry Wall, Tom Christiansen, and David Swartz (I think thats his name).

      They are informative and fun to read because of the humor and relevant info that are in the books. I have a copy of the 1st edition of the Perl Cookbook, and it is probably my favorite programming book that I own, and I would imagine that I'll be getting the 2nd edition shortly.

    5. Re:Doesn't work for Perl 6 though... by mdavids · · Score: 1

      What you say is true for Perl 6 the language, but not perl 6 the interpreter.

      My understanding is that the perl 6 interpreter, despite being a ground-up rewrite, will run Perl 5.x scripts perfectly well.

      From what I can gather, the perl6 interpreter will consist of a sort of 'meta-interpreter' (Parrot), plus modules that tell it how to interpret a particular language. The interpreter will automatically detect which language (and which variant of the language) you are trying to use. So you could, in principle, use the perl interpreter to run scripts in Perl5, Perl6, Python, Ruby, Basic, whatever.

      This is not only cool, but apparently necessary, since the perl6 interpreter uses perl5 regular expressions for parsing scripts. Not only that, but it all allegedly runs faster than ever. This sounds too good to be true of course, so I may have fallen victim to one of Larry Wall's elaborate jokes.

      Anyhow, you're right in one sense; that if you want to speak the Perl6 dialect of Perl, you'll need a new book. But if you just want to get the job done as quickly as possible, which is what the cookbook is all about, this edition (and indeed the last, which I won't be trashing any time soon) will be useful for a long time to come.

    6. Re:Doesn't work for Perl 6 though... by screenrc · · Score: 1

      His name is Randal Schwartz (not David Swartz),
      but you have already said that the name was
      probably incorrect.

  3. YOU FLAIL IT! by Anonymous Coward · · Score: 0

    Die windows! DIE!

  4. But.. by rf0 · · Score: 0, Troll

    It doesn't tell you how to build the kitchen sink

    Rus

    1. Re:But.. by Anonymous Coward · · Score: 0

      Any perl developer should have already learned to do this. Hubris!

    2. Re:But.. by spauldo · · Score: 1

      Kitchen sinks are traditionally written in LISP and integrated into emacs :)

      --
      Those who can't do, teach. Those who can't teach either, do tech support.
  5. Mmmm... by Anonymous Coward · · Score: 0
    perl necklace.pl
    1. Re:Mmmm... by Anonymous Coward · · Score: 0

      Who knew Billy Gibbons was a hacker?

  6. I WANT A PERL NECKLACE by Anonymous Coward · · Score: 0

    thx.

  7. Perl6 is a mistake by Anonymous Coward · · Score: 0, Flamebait
    I've been using perl pretty much constantly since the Pink Camel, and believe me, Perl 5 is an extremely good language for quick scripting things. That's what it was designed for. Sure, you can do big projects in it, but it's not exactly ideal. Recently I've started using Ruby as well, and I intend to move my department over to it instead of wasting time with Perl 6.

    One of the goals of Perl 6 is to make non-trivial projects possible. That's good. The way it's being done is bad. Perl was once a lightweight, extremely flexible language. Now it's become a huge ugly monster. People wanted OO, so a nasty hack was bolted on top to allow some semblance of it. Now this nasty hack is being expanded. Sure, the code's different, but the basic form is the same. Kludge upon kludge upon kludge; I'd much rather have a nice, clean, pure language (and not one with loads of irritating whitespace thank you very much).

    The same goes for the syntax. All the switching between $, @ and % is really irritating (ask a newbie how to get at the length of the keys array of a hash inside a hash, for example), and the changes proposed for 6 are just making this worse -- it seems that Larry, in his infinite wisdom, wants to prefix every data type with a different hard-to-type character. Perl was only designed for the three data types, and adding more is a mess.

    Perl 6 is a complete rewrite, but it keeps all the mess which has accumulated over the previous versions. This is not good. Sure, my const int $var = 27; may look neat (in the same way that, say, Pascal does), but $var isn't entirely constant, or entirely an integer, it's just a hack which makes it sort of behave like one. The whole thing is an exercise in pseudo-computer science masturbation with little real purpose except to please the managers who dislike the one thing that makes Perl special.

    On a similar note is regexes. I'm an avid fan of regular expressions simply because a nondeterministic finite automata is far more flexible than linear code. However, Larry must have been smoking that cheap $2 crack when he wrote this. Does he want Perl 6 to be flex or something?

    I won't be going on to use 6. It's a nice idea, but it's completely unnecessary. It won't make large projects any easier to manage (the language is still, at heart, an almighty hack -- an impressive one, but still a hack). It won't make OO any cleaner. It won't make development any faster. To put it bluntly, Perl scripts will still look less beautiful than our friend Mr Goatse. I'd prefer to use a language which has always been pure synthesis of science and engineering, not some half-baked imposter.

    Perl 6 will be nice, but I'm guessing it will be the end of Perl. It can't do what it wants to do whilst still being based upon a nasty mess. There are now other options, which provide all of Perl's power and none of the mess. Sorry, but *BSD^H^H^H^H Perl is dying. Larry is buggering it up the ass without lubricants, just like Shoeboy is doing to Larry's daughter.

    1. Re:Perl6 is a mistake by blinkylights · · Score: 1

      Perl6 is a mistake (Score:0, Flamebait)

      ...but you get a +1 for working in the word "masturbation" and the phrase "nondeterministic finite automata" into the same post. Congratulations, nicely done. :)

    2. Re:Perl6 is a mistake by Trejkaz · · Score: 1

      Flamebait only because he's pointing out that Perl is a hack? Come on moderators, that comment was Insightful.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
  8. How do you test Unicode? by GGardner · · Score: 4, Interesting

    So, I've got perl scripts which may need to work on Unicode and non-ascii character sets somtime in the future. Today, I just test them with UTF-8, and it seems to work, but who knows if they really do work on those funny character sets? I can't read Kanji or other non-ascii characters. How can I test to see if they do work? Ideally, I'd like to have an xterm-like window that uses my standard keyboard to generate analogs to all my ASCII characters, but with some test encoding that puts them into some 16 bit character set range. This way, I can make sure that since we've gone to all this work to add Unicode support into our scripting languages that it does indeed work. Does anyone know how to test this?

    1. Re:How do you test Unicode? by Bingo+Foo · · Score: 1

      The way to do this is to use the CPAN modules Test::Harness, CharacterSets::Unicode, CharacterSets::Kanji, CharacterSets::UTF8, WideChars::ASCII, WideChars::Unicode, WideChars::UTF8, PerlCore::NonASCII, PerlCore::FuturePerl, Term::XTermLikeWindow, PerlCore::Language::Scripting, Standard::Keyboard::Generate::Analogs::ASCII, and of course, Add::Unicode::Support::Into::Our::Scripting::Langu ages::That::Does::Indeed::Work

      --
      taken! (by Davidleeroth) Thanks Bingo Foo!
    2. Re:How do you test Unicode? by Anonymous Coward · · Score: 0

      Ideally, I'd like to have an xterm-like window...

      You could, um, write one. In Perl.

  9. MOD PARENT FLAMEBAIT by Anonymous Coward · · Score: 0

    Thank you. He's insulted quite a few people in his post.

  10. My problem with Perl by Eric+Ass+Raymond · · Score: 0
    My problem with Perl is the ubiquitous use of the regular expressions.

    Some people are good at learning stuff by heart. I am not one of them. As a result, I've neither been good at (bio)chemistry (that's why I became a physicist) or at learning the syntax of regexps. To me Perl code looks like line-noise you used to get when you used a modem on a bad line. It's the same thing with Emacs' controls. There's just no logic in it.

    So, my question is: how the hell do you remember all those codes (perl, emacs, chemistry,...)?

    1. Re:My problem with Perl by Anonymous Coward · · Score: 0

      What you do is learn step by step.

      You didn't remember all the digits or alphabets to begin with..

    2. Re:My problem with Perl by DG · · Score: 3, Insightful

      Like learning any new language (and the regular expression syntax IS a sublanguage into itself) the best way to learn it is to actually work with it for a while.

      After a little hands-on work, you'll start to understand the logic behind all the line noise, and once you get to that point, the pure beauty of regexes and what they can do becomes clear.

      In a way, it's a little bit like learning to program assembler. At first, all those opcodes are just a confusing mess, but once you get the hang of it, it starts to become clear.

      DG

      --
      Want to learn about race cars? Read my Book
    3. Re:My problem with Perl by romcabrera · · Score: 1

      Read man pages and practice a lot as everybody else.

    4. Re:My problem with Perl by KILNA · · Score: 1

      After a period of time the regex parasite eventually wraps its tentacles around your brain stem, bending you to its will. This has the superficial appearance of understanding, but it's actually just shooting your brain full of mind altering substances to keep you docile. Regexes are something that you're infected with or not. Most of the people who are (like myself) wouldn't try to parse text without the nifty shortcuts it provides. The occasional squirt of dopamine is nice, too.

      --
      Error: PANTS NOT FOUND. Press <F1> to continue.
    5. Re:My problem with Perl by toomuchPerl · · Score: 1
      There's plenty of logic to it.
      You mentioned you're a physicist -- how do you remember all those rules and formulas? The same principle applies. Writing regular expressions isn't complicated. It just takes time to learn well, like anything else. And "learning stuff by heart" is just rote memorization -- even animals can do that.

      -toomuchPerl

    6. Re:My problem with Perl by Anonymous Coward · · Score: 0

      if you're a scientist you should have no problem learning a simple rigourus language.

      it's a state machine based on a simple set of operations.

      It took me an afternoon to learn regular expressions. it took me 2-3 years to get equally comfortable with the rest of Perl (it is very ambiguous and too clever sometimes).. I'd think your experience would be similar.

    7. Re:My problem with Perl by Frater+219 · · Score: 2, Insightful
      My problem with Perl is the ubiquitous use of the regular expressions.

      It's true that people writing in Perl tend to use regular expressions in places where they're not necessarily appropriate. For instance, algorithmically speaking, subsequence matches are faster than regular-expression matches. (This is why Python has the .startswith and .endswith string methods, and the in operator.) However, the Perl regular-expression engine (PCRE) is optimized to heck and its raw speed can usually overcome this.

      That said, the traditional regular-expression syntax is rather arcane. The only real alternative I've seen is the S-expression syntax of cl-ppcre -- the Common Lisp PCRE implementation. This allows you to write complex regular expressions as tree structure rather than as strings of character glyphs.

      For instance, in place of the regex string "(?:foo)|(?:bar)|(?:b(a|(?:uz))z)" you can write:

      (:alternation "foo" "bar" (:sequence "b" (:alternation "a" "uz") "z"))

      Now, that might not be any clearer to you if you don't know Lisp, but it gets better as the regex gets more complicated. (I've been a little tricky by putting a lot of ?: in the original regex string. That's the code for "I want to do grouping, but I don't want to capture groups into variables." In the Lisp syntax, you have to mark when you do want capture, not when you don't. People writing in Perl usually let their groups get captured even when they don't make any use of the resulting variables.)

      Interestingly enough, the authors of cl-ppcre claim that it outperforms Perl -- a remarkable claim, but they seem to have pretty comprehensive statistics as to when it does and when it doesn't. It's odd to think that even though many people think Lisp is slow, compiled Lisp can really be quite speedy for tasks that people usually use a specialized language for.

    8. Re:My problem with Perl by jomagam · · Score: 1

      Perl 5 regular expressions are quite similar to regular UNIX regular expression, which should make your learning curve smoother. IAW, simple stuff is like UNIX, you'll just have to learn the advanced stuff if you want to use it. This is pretty much in line with perl's philosophy of making easy things easy and difficult things possible.

    9. Re:My problem with Perl by devphaeton · · Score: 1

      My problem with perl isn't perl itself. I have a fundamental understanding of the language, and a pretty good idea of where its niche is and what it can do for me.

      I just don't have any projects!

      I want to learn perl, but writing up half-hearted mock scripts doesn't teach you the same way as using it (or any language, package, device) to fulfill a certain need.

      I'm also concerned about having to re-learn perl all over again when Perl6 is released.

      --


      do() || do_not(); // try();
    10. Re:My problem with Perl by Anonymous Coward · · Score: 0

      You mentioned you're a physicist -- how do you remember all those rules and formulas?Physicists don't remember lots of rules and formulas, they remember a few principles and deduce what they need. It is chemists who must remember random facts, which is why the poster said he was not a chemist.

    11. Re:My problem with Perl by Smallpond · · Score: 1

      If you have something important to do, use perl. If you don't, then use perl/Tk. Its easy to learn, and good for writing short, silly graphics apps that will run equally well (or poorly) in Linux or Windows.

      Of course, in that case you alse need Mastering Perl/Tk

    12. Re:My problem with Perl by Corgha · · Score: 1

      For instance, in place of the regex string "(?:foo)|(?:bar)|(?:b(a|(?:uz))z)" you can write [...]

      Dude, I realize your post is about knocking perl regexes, but there's no need to obfuscate what could just as easily have been written as:

      foo|bar|b(a|uz)z

      or, even more simply, as

      foo|buzz|ba[rz]

      if you did not want to capture the a|uz, since you didn't indicate that you wanted to do so in your Lisp expression. Your eyes can pick that last one up in one chunk, and there's no need to scan back and forth to remember what it's doing.

      In any case, just because Lisp is parenthesis-happy doesn't mean perl regexes have to be.

    13. Re:My problem with Perl by kruntiform · · Score: 1

      A good way to learn regular expressions is to get Python and do experiments with them in the interactive interpreter. That way you get immediate feedback, which is good for learning. According to the docs, Python's regular-expression syntax is "similar to those found in Perl"; so you could transfer your knowledge back to Perl (or just stick with Python, hehe).

    14. Re:My problem with Perl by hackstraw · · Score: 1

      PCRE stands for Perl Compatable Regular Expressions, its an implementation of Perl's regular expressions that is separate from Perl proper. Also, I doubt that python's .beginswith .endswidth string methods are any more efficient than Perl's $string =~ /^text/; or $string =~ /text$/; regular expressions. Anchored searches are the quickest.

      I don't do lisp, so

    15. Re:My problem with Perl by nova20 · · Score: 1
      Keep a reference book handy. I use O'Reilly's Learning Perl and Programming Perl. I'm probably going to run out and get The Perl Cookbook as well.

      /nova20

    16. Re:My problem with Perl by doom · · Score: 1
      Eric Ass Raymond wrote:
      My problem with Perl is the ubiquitous use of the regular expressions.

      Some people are good at learning stuff by heart. I am not one of them. As a result, I've neither been good at (bio)chemistry (that's why I became a physicist) or at learning the syntax of regexps. To me Perl code looks like line-noise you used to get when you used a modem on a bad line. It's the same thing with Emacs' controls. There's just no logic in it.

      So, my question is: how the hell do you remember all those codes (perl, emacs, chemistry,...)?
      This is actually a pretty interesting point. You're right that it's a problem that computer engineering requires a command of a vast number of largely (if not quite entirely) arbitrary intellectual constructs, and I agree that the sheer quantity of stuff you need to know is a difficulty. In fact this is one of the reasons I haven't even bothered to look at Ruby, PHP, or Python: I know Perl pretty well, and despite claims that these other languages have some stupendous advantages, they sound to me an awful lot like just another way of doing things that I already know how to do. (On the other-hand, learning more about the lisp-like languages makes some sense to me, since they've genuinely got a different approach to things...)

      But to answer your question about how do you remember all of that stuff, the only thing I can say is that you play with it and get it to do things. To take your example of emacs, yeah it doesn't make a lot of sense that you do a CNTRL p to go the the "previous" line (why not u for "up"?), but if you do it a lot the immediate feedback you get from the hitting that keyboard gesture eventually burns the meaning of it into your hindbrain.

      Actually, I guess there's one more thing you can say: there's often an underlying logic behind the design choices that you start to percieve after awhile. Sometimes this "logic" is just a matter of historical echoes, because the current design will always imitate a previous design in some respects. In the case of perl, it's regular expressions have a lot of similarities to the regular expressions used by other, earlier unix utilities (grep, awk, etc). It was done that way on purpose: the idea was that if you were familiar with unix, perl should be easy for you to pick up, and that pretty much worked: perl is very popular with unix admins. (Though as I understand it, it often goes the other ways these days... people learn perl first, and then discover later that they learned alot about unix.)

    17. Re:My problem with Perl by Anonymous Coward · · Score: 0
      You mentioned you're a physicist -- how do you remember all those rules and formulas?


      Simple, all major physics equations boil down to:

      [something] = zero.

    18. Re:My problem with Perl by Trejkaz · · Score: 1

      At least chemistry has an 'official correct way' to write any compound.

      Even Larry wants you to use a dozen different methods to perform a single task.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
    19. Re:My problem with Perl by Trejkaz · · Score: 1

      Yeah, languages within other languages usually save time. If they didn't, they wouldn't be there in the first place.

      It's funny how many people will bitch about regular expressions, but only a very few people bitch about something much uglier like XPath. Maybe it's just that not too many people have been exposed to XPath to complain about it yet. :-/

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
    20. Re:My problem with Perl by Frater+219 · · Score: 1
      Dude, I realize your post is about knocking perl regexes,

      Actually, it wasn't. It was a discussion of the ways people use regex in Perl, and of the only other regex notation I'm familiar with besides Perl's.

      Did you know that there are thousands of people in the world who discuss all manner of differemces without "knocking" anything? For instance, when biologists who study insects meet biologists who study lizards, they do not rant at one another about whether lizards r0x0r and insects sux0r or vice versa.

      but there's no need to obfuscate what could just as easily have been written as: foo|bar|b(a|uz)z
      Well yes, but I was using "foo" to stand in for any sequence. It was intended as an example of a more full regex syntax.

      Oh, and don't call me "dude".

    21. Re:My problem with Perl by screenrc · · Score: 1
      Physics and Chemistry is also full of line
      noise (and not even on the same line). Does that mean it will be better to
      use instead English-like symbols? No. Most
      chemists and mathematicians would prefer
      to use what they already have. They only ones
      who actually complain are those who are just
      started learning Physics, Mathematics, or Chemistry.


      How do you remember all these symbols, is the
      same how you remember all these words in the
      English language. You learn them!

    22. Re:My problem with Perl by Corgha · · Score: 1

      Did you know that there are thousands of people in the world who discuss all manner of differemces without "knocking" anything? For instance, when biologists who study insects meet biologists who study lizards, they do not rant at one another about whether lizards r0x0r and insects sux0r or vice versa.

      I think your reply is a bit of an over-reaction. Never did I say you ranted, and there's no call to become condescending. "Knock" is a pretty mild term for criticism. I don't think it's out of line to say you are criticising PCREs, and specifically their syntax, when you say the syntax is "arcane" and use words like "clearer" and "better" when describing the syntax of Lisp expressions.

      I'm not trying to start a flame war either. I just think that, in the interest of level-headed discussion, you should make fair comparisons.

      It's funny that you invoke biological science. A biologist, when performing an experiment, tries to limit the changes between groups to one independent variable, as do all scientists.

      When comparing the clarity of expressions in two different syntaxes, the syntax is your independent variable. It doesn't provide a valid comparison to introduce needlessly another variable by changing what the expression does.

      Well yes, but I was using "foo" to stand in for any sequence. It was intended as an example of a more full regex syntax.

      But in the Lisp sequence, "foo" is just a simple string. In the perl sequence, you use a grouping operator for no apparent reason.

      The equivalent expression to the PCRE (?:foo) in CL-PPCRE is (:group "foo"), not "foo". The equivalent expression to the CL-PPCRE "foo" is the PCRE foo, not (?:foo).

      Similarly, you don't use (:register ...) in the CL-PPCRE expression when you use (...) in the PCRE expression.

      It may seem like I'm picking nits, but that's what syntax (and science) is all about -- details. When you're making a comparison of syntaxes, these things are important.

      So, the point of my post is that you should compare apples to apples. To do otherwise is to use the techniques of the very r0x0r/sux0r trolls you decry.

    23. Re:My problem with Perl by bill_mcgonigle · · Score: 1

      Have you tried Regexp::English?

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    24. Re:My problem with Perl by bill_mcgonigle · · Score: 1

      That said, the traditional regular-expression syntax is rather arcane. The only real alternative I've seen is the S-expression syntax of cl-ppcre -- the Common Lisp PCRE implementation. This allows you to write complex regular expressions as tree structure rather than as strings of character glyphs.

      Sounds like Regexp::English, only less explicit.

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
  11. Re:Perl and Python... by BillFarber · · Score: 1

    Wow, I didn't know GOD had a slashdot account. I bow before thee, oh Great One.

  12. Silly Gripe? by mopslik · · Score: 1

    ...now it turns out I should've been specifying an edition number also.

    Why not do this in the first place? Anyone who's written a university essay knows the importance of edition numbers. Page-numbering is particularly vulnerable, since even small clarifications will shift things around.

    A different, and likely just as effecitive alternative, is to not specify the recipe number at all. Surely there's an index where you could look up "Schwartzian transform" without hard-coding the number.

  13. Re:Perl and Python... by Anonymous Coward · · Score: 0

    you must have you head so deep in the bits of the subsystem that I am surprised you raised your head to read this article... geez

  14. Hate to argue... by Anonymous Coward · · Score: 0
    but this is not in keeping with the 'Tao' as
    illustrated in the following holy snippet..

    "There once was a user who scripted in Perl: "Look at what I have to work with here," he said to a master of core, "My code is interpreted dynamically, the syntax is unique and simple, I have sockets, strings, arrays, and everything I could ever need. Why don't you stop meddling in C and come join me?"

    The C programmer described his reasoning to the scripter: "Script is to C as ebonics is to Latin. If the scripter does not grow beyond that of which he scripts, he will surely {die}. Besides, without C, how can there be script?"

    The scripter was enlightened, and the two became close friends.


    Just trying to save you from eternal damnation ;-)
    1. Re:Hate to argue... by Anonymous Coward · · Score: 0

      Tao my arse. What of the C programmer? Did he attain enlightenment too?

  15. Perl is like sex by Anonymous Coward · · Score: 4, Funny
    • It's easy enough to get started, but takes years to get really good
    • Doing it fast doesn't mean doing it well
    • It's the little details that continue to amaze you
    • You don't learn it from a book
    Remember to actually use perl if you want to experience the bliss of perl.
    1. Re:Perl is like sex by romcabrera · · Score: 1
      A.C. you forgot the most important likeness:

      THERE IS MORE THAN ONE WAY TO DO IT!

    2. Re:Perl is like sex by vt0asta · · Score: 1
      Doing it fast doesn't mean doing it well
      However, sometimes a quicky is all you need.

      --
      No.
    3. Re:Perl is like sex by Urkki · · Score: 1
      how about

      It can get messy

      If you aren't careful, you end up with a little monster you wish you had aborted before it got too big

    4. Re:Perl is like sex by Anonymous Coward · · Score: 0

      Everybody talks about it but very few people use it for anything important.

    5. Re:Perl is like sex by Angst+Badger · · Score: 1
      • It's easy enough to get started, but takes years to get really good
      • Doing it fast doesn't mean doing it well
      • It's the little details that continue to amaze you
      • You don't learn it from a book

      On the other hand, also like sex, it won't take as many years to get really good if you do bother to read some well-written books on the subject. Perl books tend not to have as many pictures, though.

      --
      Proud member of the Weirdo-American community.
    6. Re:Perl is like sex by spektr · · Score: 1

      And there's a Kama Sutra available for it: Larry Wall's Programming Perl, which has the subtitle "There's More Than One Way To Do It".

      This is the Fucking Manual, everybody tells you to read when you ask stupid questions.

    7. Re:Perl is like sex by Derleth · · Score: 1

      And, in addition to the obvious TIMTOWTDI, what's beautiful to one may be ugly to another.

      And the most enjoyable similarity: If you get curious, you can always try it in private with a trusted partner! (Uh, does the computer count as a partner?)

      --
      How can you use my intestines as a gift? -Actual Hong Kong subtitle.
    8. Re:Perl is like sex by puppetluva · · Score: 1
      I agree, but for different reasons:

      It isn't easy to get started, and most people only do enough to get finished quickly.

      Even if you are extremely careful you'll probably end up with a big mess.

      If you look at Perl long enough, you wish you'd done it with something else.

      You and your partner are fantasizing about better equipment (Python) and/or gemstones (Ruby).

      It can be constantly interrupted by poorly constructed arguments and (de)referencing past mistakes

      It doesn't scale well beyond two developers. (and usually not past one).

  16. perldoc.com by scoobydo · · Score: 2, Informative

    I have found www.perldoc.com quite useful for multiple versions of perl.

  17. safari? by AssFace · · Score: 1

    I haven't bought a technical book since I have moved out of the States - O'Reilly's Safari has been nice for that. I can still have access to their books.

    I haven't looked to see if this new one is on there yet - I have the old version of it in paperback form as I do with pretty much all the other O'Reilly Perl books.

    --

    There are some odd things afoot now, in the Villa Straylight.
  18. Re:?Review? Como es? by Anonymous Coward · · Score: 0
    theAbove

    I moderation , the Slashdot . of how the believes enlighten system in place am greatest political troll someone very at as is ? confuses a system me in curious about unfair It who demonstration Democracy ever .

  19. MOD PARENT UP FUNNY! by Anonymous Coward · · Score: 0

    Lol!

    But you got it kinda wrong, Christians are logical only when they want to be. They resolve conflict in their heads using some form of doublethink. Actually everyone does this but Christians are the best by far. And Muslims.

    Don't forget Jews!

    1. Re:MOD PARENT UP FUNNY! by Anonymous Coward · · Score: 0
      Actually everyone does this ...

      Not this atheist.

  20. Re:Perl and Python... by Anonymous Coward · · Score: 0

    -1? Do no moderators have a sense of humour?

  21. Errors? by pagansage · · Score: 1

    Very little has been removed (hence the page count has gone from 757 to 927), and where I have been able to find a deletion, there are usually very good reasons for it.

    Correct me if I am wrong but I seem to remember that the first edition had quite a few errors (both syntactic and semantic). I'm guessing that the second edition has cleared all these up. However, when I try to access the errata for the first edition I can't find it! Surely support for previous editions doesn't "end" upon publication of newer editions. It is O'Reilly afterall...

    1. Re:Errors? by gregarican · · Score: 1
      I found this to be the case as well. That has to be a huge pet peeve with me. Any technical book that has source code listed should be proofed. There is a C++ book out there that I just got done reading and there was source code listed that wouldn't even compile due to forgetting include statements or leaving out a bracket or semicolon. You would think the authors or a proofing team would at least try to compile the code that was in the edition!

      I agree with another post. PHP, Python, and other ways to go are head and shoulders above Perl. I last used Perl seriously back in the last 90's.

    2. Re:Errors? by WNight · · Score: 1

      If you find PHP to be head and shoulders above anything, let alone Perl, you're nuts. PHPs broken Array/Hash implementation reeks and it's got a million inconsistencies where in most cases something works one way, in the other 5% it picks a random way to operate.

      PHP is the driving force behind mod_perl. It's great for small to medium stuff but I'd hate to write something big in PHP. (At least, where the guts are in the PHP - if it was only for templating it would be okay.)

  22. Re:Perl and Python... by crow · · Score: 1

    I know it's flamebait, but I would point out that one thing that Perl and Python let you do that sed/awk/grep don't is deal with networking. There once was a project to reimplement all the standard Unix utilities in Perl. Without debating the wisdom of doing so, I would like to know how you could implement an FTP server in awk.

    On the other hand, I'll admit that I never learned Perl because everything that I needed to implement could, indeed, be done with awk and sed--they are quite powerful for text processing, but it's important to realize that they have limitations.

  23. cookbook by Anonymous Coward · · Score: 0

    mmmm... tasty

    camelsteak!
    hump-b-que!

  24. MOD PARENT FLAMEBAIT, as well by Anonymous Coward · · Score: 0

    Guy obviously doesn't know the difference between a Scripting and Programming language.

    1. Re:MOD PARENT FLAMEBAIT, as well by Anonymous Coward · · Score: 0
      I see you don't know the difference, yourself.

      http://www.answerbag.com/q_view.php/948 http://compilers.iecc.com/comparch/article/93-08-0 96

      Essentially there is no difference. Most so-called scripting langauges are turing-complete. Generally, scripting languages are interpreted and more application-specific, while programming languages are compiled and general-purpose. But considering the power of most scripting languages, they can be used for general-purpose programming, so the difference is more in how you use them than in anything else.

  25. Know the index... by jargoone · · Score: 2, Informative

    of the cookbook. Hell, keep the electronic version in a text file somewhere. There have been at least a couple of times I've finished writing a script, then I've looked in the Cookbook and found a better-written solution.

    It's unique in that it doesn't just tell you about specific language properties. It actually gives a problem, a solution, and an explanation.

  26. Re:Perl and Python... by andy@petdance.com · · Score: 1
    There once was a project to reimplement all the standard Unix utilities in Perl.

    That would be the Perl Power Tools project.

  27. Happy Day by Starky · · Score: 1
    The Perl Cookbook is one of the top three technical books I've purchased. If the new version improves on the old version, it is a must-have for anyone who does anything with Perl.


    Regardless of the religious wars over languages, I have time and again found Perl to simply be the most practical language for the job and continue to enjoy using it for a variety of tasks and watching it mature.


    There is no substitute for the CPAN or Perl's ability to get the job done quickly and easily with an active community providing free (and very effective) support. Both Perl and the Perl Cookbook are an integral parts in my toolkit and for anyone who uses it, whether from time to time or regularly, I recommend it.

    --
    -- My choice of computing platform is a symbol of my individuality and belief in personal freedom.
  28. NO MORE by Anonymous Coward · · Score: 0

    No more FUCKING PERL books! Larry is GAY!

  29. Schwartzian Transform by gnat · · Score: 3, Informative
    Was it dropped because of a feud? It's great to be told why I do things :-) I don't remember it that way. The bit we deleted was just not a very useful observation. As you can tell, we tended to drop the parenthetical asides (when we remembered) to try and prevent bloat. My biggest fear was that we'd break 1k pages in this edition ...

    But I guess it's convenient to think of everything that happens as being the result of a feud and ignore inconvenient facts like the "Schwartzian Transform" name still being mentioned in the long entry on sort function in Programming Perl, 3ed, which Tom also cowrote. Hmm, maybe I shouldn't point that out--now I'll be accused of having a feud with Randal!

    --Nat

    1. Re:Schwartzian Transform by doom · · Score: 1
      gnat responded:
      Was it dropped because of a feud? It's great to be told why I do things :-) I don't remember it that way. The bit we deleted was just not a very useful observation. As you can tell, we tended to drop the parenthetical asides (when we remembered) [...]
      Well okay, this is a case where I'm happy to hear that I'm wrong. My apologies.
    2. Re:Schwartzian Transform by Anonymous Coward · · Score: 0

      Tom Christiansen, the co-author, is said to have a long-standing beef with Randal Schwartz, of the Transform fame. It's not exactly Pac vs. Biggie, but it's part of Perl lore.

      Christiansen has been involved with Perl since it was released to the Usenet wilds in 86 and was embittered when Schwartz's name appeared on the Camel. Tom's contribution is unquestionable, but Randal seems like a nicer guy to me, and a better ambassador also.

    3. Re:Schwartzian Transform by merlyn · · Score: 1
      My name appeared on the first Camel because it was originally only my book. I invited Larry to co-author, and designed both the first and second editions using proven practices from my prior publishing career.

      Tom would want to rewrite history, making you believe that it was Larry's book, and that he asked me to co-author for some unjustifiable reason. That's clearly not the case. Check the facts first, please.

    4. Re:Schwartzian Transform by merlyn · · Score: 0, Flamebait
      Hi Elaine. Posting anonymously again, I see. Thankfully, your writing style and subtext always gives you away.

      As for this:

      I'm sure there are plenty of 'facts' known by ORA editors that you wouldn't want made public
      I would completely disagree. I challenge anyone to bring forward anything for which I'm not willing to take public responsibility.
    5. Re:Schwartzian Transform by Anonymous Coward · · Score: 0

      No, I know how to spell Randal. However, I can't say that I disagree with the sentiment of that poster. Only you could take an editorial gaffe or a simple request to remove pictures from your website and turn it into a "they're picking on me" kind of whinefest just to draw attention to yourself. Considering how rushed to press this hefty book was, I'm surprised there aren't far more glaring problems...at least Tom and Gnat know how to spell your name, unlike the reviewer. Changing your name to Dirtbag Q. Bosche might help that problem though.

      You get what you give in this lifetime.

      e.

    6. Re:Schwartzian Transform by Anonymous Coward · · Score: 0

      Pot. Kettle. Black.

      Haven't you had enough of harassing Randall yet?

      He doesn't have to remove those pictures if he doesn't want to. The law is on his side.

      Grow the fuck up, willya?

  30. Re:Perl and Python... by trippinonbsd · · Score: 1

    I dont know about FTP but here is a http server written in awk.
    Enjoy!

  31. You fail it by Anonymous Coward · · Score: 0
    The proper statement is:
    Why don't you code in Visual C#.NET, you GNU hippies?
    Please refer to troll manual.
    1. Re:You fail it by Anonymous Coward · · Score: 0

      Shut your jealous trap, dickwit.

  32. Apache::ASP is better than PHP by babylon93 · · Score: 0

    I've tried lots of templating schemes with perl-based web development, but Apache::ASP is my favorite so far.

    With the XMLsubs, $Request, $Response, $Server, $Application and $Session objects I am able to focus on the task at hand, rather than figuring workarounds to the limitations of the language I am using.

    Global variables, cached database connections & queries, shared session-state and full access to the Apache API give you the power to do anything you need to.

  33. XML Chapter by gnat · · Score: 2, Interesting
    Thanks! In a testament to the power of caffeine and good friends, that chapter came together in the space of about four nights. I'd work regular business hours doing editing, then at 9 or 10pm I'd write the XML chapter. I got great feedback and clarifications from Matt Sergeant, Dan Brian, Michel Rodriguez, Adam Turoff, Robin Berjon, and other such Perl XML luminaries.

    As you would have guessed if you heard me speak in 2000, I'm not the biggest XML user. I've mellowed since then, but I still don't do a lot of XML hacking. (One of the spare-time hacking things I've while here at O'Reilly, though, is to get our internal database of "what books are at what stage" into XML for easy grepping and reuse).

    Of all my work in the 2nd edition of the Cookbook, the XML chapter is the one I'm proudest of. I'm really glad you like it. Thanks!

    --Nat

    1. Re:XML Chapter by doom · · Score: 1
      gnat wrote:
      Thanks! In a testament to the power of caffeine and good friends, that chapter came together in the space of about four nights. I'd work regular business hours doing editing, then at 9 or 10pm I'd write the XML chapter. I got great feedback and clarifications from Matt Sergeant, Dan Brian, Michel Rodriguez, Adam Turoff, Robin Berjon, and other such Perl XML luminaries.

      As you would have guessed if you heard me speak in 2000 [frii.com], I'm not the biggest XML user. I've mellowed since then, but I still don't do a lot of XML hacking. (One of the spare-time hacking things I've while here at O'Reilly, though, is to get our internal database of "what books are at what stage" into XML for easy grepping and reuse).
      Heh. Well this may explain why you could write a good, succinct guide to the subject. If you were a true believer you might have gotten lost in asserting that XML is the greatest thing since binary numbers (when really it looks like a slight improvement on CSV files)...

      It was really funny how the XML hype kicked into high gear long before the functionality was really there... I remember checking in on what they were up to in the mid-90s and feeling mildly shocked that they still hadn't settled on a way of dealing with namespaces.

  34. Re:Perl and Python... by doug · · Score: 1

    I was amazed when I first read about tchrist's power tools project. Thanks for the link. I noticed that all the dates were from '98/'99. Did someone declare it done, or is limbo?

    - doug

  35. Don't buy it by nnnneedles · · Score: 1

    I've worked as a Perl programmer for several years, and the only book I've ever needed is "PERL - from the ground up" by Michael McMillan.

    It has among others a very handy reference to Perl's built-in functions, lots of regexp stuff and more.

    For everything else there is www.

    --
    Will code a sig generator for food
    1. Re:Don't buy it by Anonymous Coward · · Score: 0

      "PERL from the ground up" is a bad book to use. It's full of typos and bugs not to mention that the author uses code early on that doesn't get explained until much later...

      It's no wonder that Osborne stopped printing it.

  36. Christiansen on /. by craw · · Score: 1, Offtopic

    FYI. Tom Christiansen (54829) used to post comments here. He stopped because of the crap associated with the story on the death of Richard Stevens. Search for Christiansen to read his parting words.

    IIRC, then came karma.

    1. Re:Christiansen on /. by Camel+Pilot · · Score: 0, Offtopic

      Yes Tom's post is worth reading again. I have several of Stevens (and Tom's including the aforementioned) books sitting on my shelf. It is too bad that the moderation system does not do a better job of filtering out the stupid, immature and souless comments more efficiently.

    2. Re:Christiansen on /. by kisrael · · Score: 0, Offtopic

      Interesting. I hadn't heard much about W. Richard Stevens before then...and it's funny, the negative comments were modded down to hell, just leaving a lot of people pointing out the ignorance and unseemliness of the negative comments. Seemed like a strong case of "a few bad apples".

      Actually, I'm always a little amazed that any "big names" show up here, and then I'm amazed that I find that amazing.

      Feh, I wish I had gotten my username here when I started reating, instead of a year or two after. I'd have an even lower # then ;-)

      --
      SO YOU'RE GOING TO DIE: The Comic for Dealing with Death
    3. Re:Christiansen on /. by craw · · Score: 1

      Right now, Bruce Perens seems to be the "biggest name" that posts comments here. I remember a few from Rob Pegoraro, who is a tech columnist for the Washington Post. Somebody from abcnews.com also use to post a few comments.

      A long time ago, /. ran an interview of one of the lead developers for some OS project. Perusing the comments to the story, I ran across a "First Post!" that was modded up to +5 Funny. Huh? Oh, it was the interviewee! Absolutely hilarious.

  37. I call troll by JusTyler · · Score: 1

    What are you on about? One of the oft-heard criticisms of Perl 6 is that it's TOO structured. Just read the Apocalypses and Exegesises (correct my latin plurals here, if you like) and you'll see Perl 6 is really hot on structure.

    The whole thing is an exercise in pseudo-computer science masturbation

    You talk about it as if Perl operates on mysterious brand-new concepts. It's a pragmatic language. None of it is particularly unique to Perl. In fact, if you search Google for 'pragmatic programming' the Google directory link at the top is to Ruby, the language you seem to jerk off to.

    All the switching between $, @ and % is really irritating

    More irritating than having to jump several pages up your code to see variable declarations as in C /C++/Pascal?

    I'd rather know @blah is an array, and $blah is a scalar, than have to jump around code looking for ints, chars, and arrays. Of course, you could argue that we should be using a naming scheme for variables. But if so, that invalidates your point too. The @, $, % symbols are, semantically, the same as having variables called i_myint, a_myarray, etc. How hard is to learn a few symbols, anyway?

    Face it, you're anti-Perl, and that's okay, but it doesn't make you the most objective person to say which features are worthwhile or not.

  38. Implementing FTP in awk by Medievalist · · Score: 1

    It'd be pretty easy in GNU awk, which is the most advanced awk out there.

    Jurgen Kahrs implemented socket IO in GNU awk around 1997. See Robbins' O'Reilly book "Effective Awk Programming" for more details, it's a great book (even though I think the name is lousy).

    If the number of FTP commands you wanted to implement is K, I'd guesstimate you'd need about 30 + (K*2) lines of Gawk to implement a reasonably bulletproof FTP.

    Gawk ships with most linux distros, but many of them are shipping outdated versions.

  39. 15? by DAldredge · · Score: 1

    You N00B!!!

  40. Re:Perl and Python... by crow · · Score: 1

    They were able to do this because they used inetd to listed to the port for incoming connections. I don't think it is possible to write a stand-alone http server in awk, as that would require some mechanism for listening to ports. If you add in Bash, you can make outgoing connections using built-in special files /dev/tcp/host/port, but I don't think Bash lets you listen to a port for incoming connections (I may be wrong on that).

  41. Perl CD Bookshelf - 4th edition by RDW · · Score: 1

    The first edition was an essential purchase for me, but I find that I refer to the HTML version on the 'Perl CD Bookshelf' much more often than the paperback. Anyone who doesn't subscribe to Safari and wants to read the electronic edition of Cookbook 2 will have to wait until January, when it'll be included in the 4th edition of the Bookshelf.

  42. Did they update the DBM locking recipe? by Anonymous Coward · · Score: 0

    The first edition had a bug, where it could corrupt your db file. I actually used that until I noticed the warning in the DB_File manpage.
    Speaking of manpages, I'm still using the old DB_File instead of Berkeley.pm because that one has such crap documentation!

  43. Looks are deceiving. by Anonymous Coward · · Score: 0

    (:alternation "foo" "bar" (:sequence "b" (:alternation "a" "uz") "z"))

    I agree that this does look a whole lot better than the standard PCRE string but, the end result is still the same. It is illogical. There is no intuitive meaning that I can draw from the line. In other words, while it looks better it is still as dumb founding as PCRE.

    1. Re:Looks are deceiving. by Cato · · Score: 1

      This formulation is quite logical, like Perl REs. You seem to be using the word 'illogical' to mean 'requires me to learn syntax and semantics' - a bit like expecting knowledge of how to cook to leap fully formed from book to brain... Not everything in this world is intuitive at first glance, but having used REs for a long time, I find they actually *are* quite intuitive now.

  44. One advantage of Perl and Python regexes by Anonymous Coward · · Score: 0

    One advantage of Perl (and other apps/languages with loosely Perl-compatible regular expressions, like Python, libpcre and KDE) is that its regexes are consistent. To get non-magic behaviour, you put a backslash before punctuation, or no backslash before a letter/number; to get magic behaviour it's the other way round. You can turn an arbitrary string into a regex literal by inserting a backslash before any non-alphanumeric character.

    Compare with, say, GNU grep: () isn't magic, but \(\) is; unless of course you're in egrep mode, in which case it's the other way round. \< and \> are magic regardless, and <> aren't, but *^$ are magic and \*\^\$ aren't. Suddenly turning strings into regex literals requires in-depth knowledge of precisely which characters are "magic".

    (If you're doing something non-trivial, it's also handy having C-style flow control, and being able to evolve your "quick hack" Perl one-liner into a full script with functions, modules and stuff.)

  45. No Comments: That's the real problem by bigredradio · · Score: 0

    Most of the time when learning a new language, (Perl is no exception), to get your hands on source you usually have to turn to the GPL community. I love GPL, but hate the fact that no one seems to understand the importance of good comments. If there were more (and better) comments, the language might not seem like line noise to novice programmers.

  46. Bookpool has it for 30 bucks by Wee · · Score: 1
    Like subject says: bookpool.com sells the 2nd edition for $30.50, free shipping as well.

    -B

    --

    Ash and Hickory, straight-grained and true, make excellent bludgeons, dandy for the cudgeling of vegetarians.

    1. Re:Bookpool has it for 30 bucks by philll · · Score: 1

      Although minimum order for free shipping is $40.

  47. die if (perl_cookbook == 'poop') by Charlie+Bill · · Score: 1

    I'm rather partial to R. Schwartz's books on the topic, the "pearl" book, the "camel" book -- I've never been a fan of tchrist and the documentation he writes. I secretly suspect him of authoring the awful OOP chapter in the Camel book.

    Back in the day the venerable "Perl 5 HOWTO" was the shizzy for doing stuff before there was a billion modules in CPAN to do pretty much everything. I still refer to it when I need to write a server from scratch, even though its probably five years out of date now.

    To the author who was confused by regular expressions: Jeff Friedel's book on the subject is excellent.

    1. Re:die if (perl_cookbook == 'poop') by Anonymous Coward · · Score: 0

      die if (perl_cookbook eq 'poop');

      also if you man perltoot you'll find, what I think is one of the best oo descriptions for perl written by Tom someone or other.

    2. Re:die if (perl_cookbook == 'poop') by Anonymous Coward · · Score: 0

      Randal likes to correct things when they serve him yet I don't see him correcting you on crediting him for writing Effective Perl Programming [ a.k.a the shiny pearl book ] which was written by Joseph Hall. Randal's name is only on the book for writing the foreward and for sales value.

  48. Perl and web security documentation by Anonymous Coward · · Score: 0
  49. Not entirely thorough by Resident+Geek · · Score: 1
    I found one issue with it as a newcomer to Perl, not immediately familiar with the various datastructures and methods of doing things: it stressed reliance on external libraries at the expense of learning other ways to do it.

    Sure, Laziness is a virtue and all that, but to cite a specific example, I looked up how to parse program options. All Cookbook has to say on the matter is to use GetOpt. This is fine, and is decent advice, until you realize that GetOpt is by no means a complete solution, as it doesn't handle special characters. I beat my head on this for too long before having to search around and learn a graceful way to parse @ARGV (being new). I would have appreciated a reminder that you don't have to stick with GetOpt, and there is in fact, MTOWTDI.

    Lesson having been learned, I would like to save other neophytes the trouble.

    --
    Fighting the War on the War on Drugs.
    http://smokedot.org/
  50. Re:Perl and Python... by cowbutt · · Score: 1
    Add nc (netcat) to your sed/awk/grep toolbox and you'll probably be able to do most of that which you can do with perl/python.

    I've (un)successfully used this to avoid learning both perl and python for some years. D'oh!

    --

  51. Re:Perl and Python... by trippinonbsd · · Score: 1

    I understand that it uses inetd, but it is a very impressive feat of awkish skill to pull this off. It makes a great use of inetd, but you are right awk has no way of making network connections as its *only* (please dont kill me) a text parser. Inetd is arguably much more efficent then having to code by hand the networking parts of your program. I'm no perl expert but i would say a shell script and inetd would possibly make a faster web server than some perl script, but then again what do i know?

  52. Before my time... by The+Ape+With+No+Name · · Score: 1, Offtopic

    ....But I can personally attest that Christiansen can be such a jerk that he can't even be approached when he is positively wrong. I pointed out a very specific bug in Perl back in the Perl 4 days which had not been fixed for weeks to him. He said it had been fixed and that I was a fuckwit for bringing it up again. Gave him code to show I could still do it. He called me a liar. I appealed to higher gods. He caught wind. Then started a campaign to squash me on comp.lang.perl.misc. That worked because of his unfailing followers. His parting shot to me was some shit about being more educated than me (seemed very proud to be able to speak a couple of languages other than English. This is an accomplishment for an American, I admit) and making money at Perl. Blah. Blah. I seriously thought this was someone spoofing the guy for the longest time, because when I met him at conference before this period, he was very forthright and pleasant. Actually, he seemed like a nice guy to hang with or maybe work for. Anyhow, I gave it a rest. Perl is just a fucking programming language. Linux is just an OS. I understand he has disappeared from USENET as well because of abuse from users, his unabiding dislike of Newbies, and lack of time in general. Anyhoodles, all programming languages and OSes suck. Some just suck less. Perl is one that sucks less. Linux is one that sucks less. Hrmph.

    --
    Comparing it to Windows will be a moot point, since El Dorado is going to have a 40% larger code base than XP.
  53. Ummm... by steveg · · Score: 1

    You mean, in case Slashdot gets slashdotted?

    --
    Ignorance killed the cat. Curiosity was framed.
  54. Re:Perl and Python... by Anonymous Coward · · Score: 0

    Inetd is arguably much more efficent then having to code by hand the networking parts of your program.

    Maybe if you're arguably retarded. The inetd model is rather inefficient. Thanks for playing, though.

  55. a feud would be double-sided by merlyn · · Score: 0, Offtopic
    Guys, if you're going to carry on a feud, this is really not the way to do it. It just makes you look bad.
    Please, let's be clear. This little spat that Tom has about me is completely one-sided. I get a bit pissy when I have to play defense, but otherwise, it's entirely about Tom attacking me. I have nothing against him otherwise.
  56. Re:Perl and Python... by trippinonbsd · · Score: 1

    I wasnt talking about speed efficeiency.