Slashdot Mirror


Best of The Perl Journal

honestpuck writes "Computer magazines come and go at an unrelenting pace. The Perl Journal was one of the better ones before Jon Orwant, the editor and publisher, passed it to CMP. It is therefore pleasing to find he has taken all the articles published over the five year period, removed the chaff and published the rest in three volumes." Read on for honestpuck's lowdown on what you can expect in this set. Computer Science & Perl Programming author Jon Orwant (Editor) pages 710 publisher O'Reilly and Associates rating 8 (7 and 6 for other vols) - Well written, some flaws reviewer Tony Williams ISBN 0596003102 (0596003110 and 0596003129 for other vols) summary Well edited compendium of magazine articles on Perl

All three volumes reveal a good hand at choosing articles and editing the contributions; after spending three years as a magazine editor I know that not all the contributors could have written this well. The writing is consistently good, tight, well edited and readable.

Across them all you will find articles by almost every major contributor to Perl and a great many of the people who have contributed major modules to CPAN. It's good to feel that perhaps a few cents from your book purchase is flowing into each of these pockets and repaying their work.

Viewing the 3 books as a whole my one real concern is that perhaps a little tighter restrictions on the article choice may have been better -- some of the articles are really only of historical interest, discussing methods overtaken by further development in Perl or the modules available. You may also find only one or two of the volumes contain articles of particular interest to you, I discovered that my favourites were spread across all three and bemoaned the semi-arbitrary division of topics as I only closely read about two books worth from the three volumes -- of course your milage may vary.

The first and largest volume, Computer Science & Perl Programming, is the one volume where I read and enjoyed almost every one of the seventy articles (by 41 different authors) included. The topics covered vary widely, from an essential trilogy of articles about regular expressions by Jeffrey Friedl to some esoteric discussion of Perl internals by Chip Salzenburg.

The second volume, Web, Graphics and Perl/Tk, contains 39 articles, around half of which are devoted to topics such as mod_perl, spidering, and other web stuff. Here is where you can find yourself reading an article about topics now made redundant by changes to Perl and its modules. The graphics section is an eclectic mix while the Perl/Tk section adds up to a fairly good tutorial on the topic.

The third volume, Games, Diversions and Perl Culture, collects 47 articles on a broad range of topics: 15 of them are about various sorts of language processing in Perl that I found extremely interesting. It also includes the Obfuscated Perl Contests, the Poetry Contest and a bunch of other "silliness." An article on how the magazine's covers were photographed seemed particularly pointless.

I'd recommend the first volume for almost anyone interested in Perl. The second might be worth purchasing if you wanted the web coverage. The third is worth it if you want the coverage of language processing or have an interest in the culture that surrounds Perl. Check the O'Reilly pages for one, two and three to see the tables of contents, index, grab the code examples and download a sample chapter (the third volume has two example chapters.) I've given the first volume an 8 but the other two get 7 and 6 respectively as the article choices make them less useful, though the quality of writing and editing is as good.

I think all three would be a marvelous addition to any decent tech library - they seem perfect for a library as they have all the benefits of a five year collection of TPJ without the problems of magazine storage, cataloging and conservation. For everyone else, grab the first one and then decide based on the content for the other two.

You can purchase Best of the Perl Journal (Volume 1, Volume 2, Volume 3) from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

123 comments

  1. Not unlike a real-life journal.... by a+XOR+b+XOR+a+XOR+b · · Score: 3, Funny

    Perl: Great thing to write, but people aren't sufficently motivated to read it unless they're trying to find something to use against you :|

    --
    Anti-slash: In sacred jihad against slashdot
    1. Re:Not unlike a real-life journal.... by Junks+Jerzey · · Score: 4, Insightful

      Perl: Great thing to write, but people aren't sufficently motivated to read it unless they're trying to find something to use against you :|

      Oh, enough of that already. The bottom line is that a programming language you are unfamiliar with looks like gobbledygook. I suppose you think Chinese and Russian are gobbledygook, too.

    2. Re:Not unlike a real-life journal.... by Daytona955i · · Score: 3, Insightful

      Haven't looked at much perl code have you? Sure perl is known for it's obfuscated code contests and it's Haiku poetry. But I think this misconception arises from it's flexibility. I think it also comes from regular expressions which can get quite cryptic quite fast, especially if you don't know what it means.

      However, as someone who just started learning perl, I think it's a great language. Learn a little about the language and then say it's hard to read. Heck, I could put all my c code on one line, does that mean it's a hard to read language?

    3. Re:Not unlike a real-life journal.... by QuijiboIsAWord · · Score: 1

      Nah...its all Greek to me.

      --
      -Hmm...I got a G+ invite, better remember to remove the request from my sig...-
    4. Re:Not unlike a real-life journal.... by Anonymous Coward · · Score: 0

      "The bottom line is that a programming language you are unfamiliar with looks like gobbledygook. I suppose you think Chinese and Russian are gobbledygook, too."

      Perl is, in my opinion, difficult to read due to it's poor syntax. That makes it, ultimately, difficult to use.

      Hell. Roman Numerals look like "gobbleygook" to someone who is unfamiliar with them, but I think we can all agree that they're absoloutly horendous to work with.

    5. Re:Not unlike a real-life journal.... by hachete · · Score: 1

      Written Perl always seems intelligible at first browse but, as you look closer at it, the less you understand.

      I can live without synonyms as well - they just make maintenance that much hard. Maintenance isn't just about reading, although that's the step. IMO, the ultimate step is to understand the intentions of the programmer - Perl doesn't make this easy in the slightest and I maintain a number of large perl scripts.

      Just as the writers of Perl 6 (where is that, BTW?) are trying to make Perl more like Python, it's all in the implementation: Perl's archaic ribbons and multiplicities of syntax charts it's baroque evolution under a methodology that's less disciplined than, "oh, lookat*that*". E.g back-ticks are worth killing, and the system command should have been overloaded.

      One of it's other problems is that it's a combination of *several* languages: the strict perl, the regular expressions and the various */ operators. Just how hard do you want to make it for some poor grunt?

      h

      --
      Patriotism is a virtue of the vicious
    6. Re:Not unlike a real-life journal.... by 1iar_parad0x · · Score: 1

      I think a better way of putting it, is that you have to expound a great ammount of effort to make Perl readable. It's a great langauge for scripting and odd projects, but IMHO it's not the best language for full blown development. I have friends who swear by Perl, but I've also had to wade through quite a bit of ugly Perl code.

      --
      What do you mean my sig is repetitive? What do you mean my sig is repetitive? What do you mean....
  2. Just a question by MrsPReDiToR · · Score: 5, Interesting

    Are they in your opinion worth reading if you haven't learnt perl yet? Its on my list to learn this year

    --
    It could be that the purpose of your life is only to serve as a warning to others.
    1. Re:Just a question by mekkab · · Score: 4, Insightful

      YES. While learning perl hands on, I found a bunch of TPJs to be invaluable resources. Heck, I've still got a bunch kicking around (one or two that were pre-glossy covered), thats how useful they are. If I ever need to Perl again, I've got them as references.

      I'd skip volume 3 (sounds kinda silly) unless you are a completist. Volume 2 sounds like the most useful and valuable- sure the article on Regular Expressions was GOOD, (I think I only read the first one) and understanding Perl internals would be a bonus, but the code examples of the web stuff is the best bet for my money.

      So get (or borrow) Volume 2, if you like, get Volume 1, and if you become a raving perl maniac, have someone get you Vol 3 for a birthday present.

      --
      In the future, I would want to not be isolated from my friends in the Space Station.
    2. Re:Just a question by Anonymous Coward · · Score: 2, Interesting

      Without having read the books you're referring to: probably not. I say that because Perl Journal material is/was pretty esoteric, and you'll spend a lot more time trying to figure out what they heck they're talking about than you will learning sleek, elegant, re-usable, intuitive, versatile, and fast coding methods. Which is what Perl really shines at.

      Further, Perl is a language that rewards exploration. You'll discover 20 wrong ways of doing things, and one day you'll settle into one you like for your own reasons. There's often not a 'best way' in Perl, only 'your way'.

      Not trying to scare you off. TPJ just isn't the best place to start.

    3. Re:Just a question by mekkab · · Score: 1

      Thats funny, my advise was a complete 180 of yours!

      I think all your points are completely valid. However for Volume 2 (which appears to be web stuff) its nice to see some code that does it. It gets you up and running. Then later on you can decide if you want to parse everything by hand crafted regular expression pattern matches, or relegate the grunt work to some module you Dl'd off of CPAN.

      Between TPJ and the Camel book I had enough to get my hands dirty and start writing some good code. I also lurked on comp.lang.perl and perl.moderated (once it split off), but that was more useful for esoteric finer points.

      --
      In the future, I would want to not be isolated from my friends in the Space Station.
    4. Re:Just a question by MrsPReDiToR · · Score: 1

      Thanks for the advice. Im just a geek in training at the mo so any help I can get I'll accept!!! I know lots about too many subjects and not enough about any one thing. Perl appeals to me though so Ill let you know how Im doing next year!!!!

      --
      It could be that the purpose of your life is only to serve as a warning to others.
    5. Re:Just a question by mekkab · · Score: 3, Insightful

      Good luck.
      The Camel Book is a great resource, too.

      The secret to perl:
      In other programming languages, when the compiler can't figure out what you are doing, it cries and gives you a cryptic error message.

      In Perl, the compiler narrows it down to a few choices, flips a coin, and goes with one interpretation. Never mind that it wasn't what you intended! Frequent use of debug statements and USE STRICT pragma and USE WARNINGS pragma should help your code.

      --
      In the future, I would want to not be isolated from my friends in the Space Station.
    6. Re:Just a question by Anonymous Coward · · Score: 0

      No.

      I'm a habitual perl code thief, and have been pleased to steal other people's perl code from nearly all of the O'Rielly books, but I don't recall once stealing code from TPJ.

      I write perl for a living and I thought that the TPJ was not very useful. Go get the Llama if you want to learn perl. I'm teaching someone perl right now, and would never dream of just handing her some magazine articles.

    7. Re:Just a question by haystor · · Score: 1

      One thing that helped me was learning that all the error messages are in the Camel Book.

      your program should start:

      #!/usr/bin/perl -w

      use strict;

      After that you should receive good error messages. When I look them up in the Camel book I'd say 90% of the time the book explains exactly what I had done wrong.

      It's wonderful compared to the horrific error messages and stack trace spam that java gives me.

      --
      t
    8. Re:Just a question by stevey · · Score: 1

      Don't forget the often overlooked "use diagnostics;" either!

      And if you're writing CGI's then for testing puposes something like "use CGI::Carp 'fatalsToBrowser';" can be a lifesaver too - but remember to setup something different when your code is in production use.

    9. Re:Just a question by chromatic · · Score: 2, Informative

      Add use diagnostics; during development, and you may be able to skip the Camel step in many cases.

    10. Re:Just a question by Kymermosst · · Score: 1

      I'd skip volume 3

      Hey now, that's the one that has some of my code in it. Of course, I don't make any money off of it, and it's one of the obfuscated code contest 2nd-place entries... but I like knowing it's out there.

      --
      "Alcohol, Tobacco, Firearms, and Explosives" should be a convenience store, not a government agency.
    11. Re:Just a question by JamesOfTheDesert · · Score: 2, Funny
      your program should start:
      #!/usr/bin/perl -w

      Then, when that doesn't seem to help, you switch to

      #!/usr/bin/ruby -w

      # :)

      --

      Java is the blue pill
      Choose the red pill
    12. Re:Just a question by allolex · · Score: 1

      The TPJ articles are directed at a more advanced audience. Depending on your programming experience, you should start with "Learning Perl" (less) or "Programming Perl" (more). The latter is a must-have for anyone serious about Perl. If you are more independent-minded, you can also use the perldoc documentation, but although it is very good, it is not as well-structured as, say, the PHP manual.

      --

      Allolex

    13. Re:Just a question by Daytona955i · · Score: 1

      I've been reading the third volume and it has some interesting articles that you will be able to understand, I wouldn't try and learn from them. I would start with either Learning Perl or Programming perl (The Camel book) (or both). Once you start programming in perl, then I'd recommend getting the other books.

  3. Damn CMP by Roadmaster · · Score: 4, Interesting

    I'll never forgive CMP for running Byte Magazine into the ground only 4 months after I subscribed. They robbed me of 8 months' worth of subscription money and they even had the nerve to suggest switching my subscription to Windows Magazine. The horror! at least Byte was more encompassing and had general-interest articles about other platforms and computer science in general, not just Windows blabber and publicity. The thieves.. filthy little thieves... Don't ever let CMP run your magazine.

    1. Re:Damn CMP by aled · · Score: 2, Funny

      Hey, they didn't offer Windows Magazine to me! Oh well, it could have been worst; they could had offer it.

      --

      "I think this line is mostly filler"
    2. Re:Damn CMP by elmegil · · Score: 4, Informative

      Sorry, but by the time you subscribed to Byte it was little more than a trade rag, and had been for ages. The Golden Age of Byte was back in the early 80's when they actually put out articles of general interest to electronics/computer geeks.

      --
      7 November 2006: The day Americans realized corruption and incompetence weren't addressing 11 September 2001
    3. Re:Damn CMP by Craig+Maloney · · Score: 1
      Yeah, the old Byte magazine was chock full of goodies back in the day. My parents bought me Popular Computing, but it was a special day when I picked up a copy of Byte. Had the best damn article on the computers behind the making of Tron than anyone else.

      Remember kids, if you could fit 12 issues of Byte on your magazine shelf, you're not reading the golden age of Byte. :)

    4. Re:Damn CMP by Anonymous Coward · · Score: 0

      I loved them 3/4" thick magazines.
      Also loved them books by Rodnay Zaks.
      I've still got "Programming the Z80" and
      "6502 Applications Book" by him.
      Also pretty cool was
      "Apple Graphics & Arcade Game Design" by Jeffrey Stanton -- I've still got a copy of that one too
      All of these books were very well written and the
      language used was assembler throughout (a bit of
      apple basic in the arcade game design book, but
      with plenty of "peeks" and "pokes" scattered throughout)
      It's amazing how small these programs are!
      2706 bytes for a complete game!
      That's for a game with an airplane flying over
      scrolling scenery with ufos and aliens that you
      shoot down -- and it keeps track of scores as well.
      I think it would be cool to port some of that old
      code.
      Seems like back then everything on computers was
      written by competent people for competent people.
      Nowadays everything seems to be written by...you guessed it...incompetent people for incompetent people.

  4. Re:italics tag? by Anonymous Coward · · Score: 0

    Hit reload? Looks fine to me.

  5. Re:Not to be confused with... by ellem · · Score: 1

    I got "Best of the Perl Necklace 3" for Christmas, do I need to have seen 1 & 2 to understand it?

    --
    This .sig is fake but accurate.
  6. Would have been much more readable... by drquizas · · Score: 4, Funny

    for Perl users if each entire article had been written on one line with no punctuation or spaces.

    1. Re:Would have been much more readable... by tcopeland · · Score: 1
      Heh. I'm looking at an August 1984 copy of "80 Micro", which was a magazine for TRS-80 users. On page 50 there's an article called "One-Liners" by a fellow named Harold Fink. Here's one of the better ones:
      6300 W=0:FORV=1TOLEN(X$):U=ASC(MID$(X$,V,1)):IFU=47W=0: NEXTELSEIFWNEXTELSEZ=VAL(MID$(X$,V+1)):FORX=0TO1:X =0:IFZ<0Z=Z+1:
      Whew. That's only about half of it. But you get the idea. This was a feature article, too... a real barn burner.
    2. Re:Would have been much more readable... by Our+Man+In+Redmond · · Score: 1

      You can't write a Perl program without punctuation.

      &duh();

      --
      Someone you trust is one of us.
  7. Perl's motto should be by Anonymous Coward · · Score: 0

    "Write-Only"

    1. Re:Perl's motto should be by repetty · · Score: 1

      "Write-Only"

      Well, I, for one, think you are funny. You probably got scored a zero on account of posting anonymously.

  8. Re:Best of Perl? by Anonymous Coward · · Score: 0

    Maybe you hang out with the wrong kinds of people. I know people who take great care in making their code readable and well-commented, even when it's perl.

  9. Re:italics tag? by britneys+9th+husband · · Score: 1

    It even seems to be affecting some of the comments. Not all of them, though. There must be some sort of weird bug in the Slashcode.

    --
    Hear recorded Slashdot headlines on your phone! New service beta testing. Just call (248) 434-5508
  10. Re:Best of Perl? by kneecarrot · · Score: 1
    Hang out with a PERL programmer? Are you crazy? :)

    Yes, of course there are individuals who code in all kinds of languages who write poor code. I was merely making a shallow generalization based on personal experience. Hey, it's slashdot, why not? :)

    --

    I always save my last mod point to mod up a good troll. You people are too serious.

  11. Re:Best of Perl? by hey · · Score: 1

    Its only cryptic if you want to make it cryptic.
    Look at this cryptic code:

    open(FILE, "/etc/passwd");
    while($line = <FILE>)
    {
    print $line;
    }
    close(FILE);

  12. Editors assume they are better than mods. by jared_hanson · · Score: 0, Offtopic

    There must be some code in the comment submission code that checks makes sure all tags are closed and closes them if not (so posters can't screw up the rendering). Is there some reason that this same code can't be used in whatever script the editors use to post stories?

    Just curious, seems this happens at least once every few months.

    --
    -- Fighting mediocrity one bad post at a time.
  13. Excuse me? by mekkab · · Score: 2

    ADA is most definitely not gobbledygook. And Perl is one of the worst offenders of gobbledygook.

    I'm so out of the Perl loop that if I just need to do some text parsing, I'll use AWK every day over Perl. Understand, of course, that Perl is more than just text parsing; its truly the duct-tape of the web...

    --
    In the future, I would want to not be isolated from my friends in the Space Station.
    1. Re:Excuse me? by TopherC · · Score: 1

      I bet that anyone can write gobbledygook in any language if they take some kind of sick pleasure in that sort of thing. And I'll agree that Perl is one of the best languages for writing gobbledygook. But most Perl code I've read and written is, to me, very easy to read. Easier even than most C++, where to read any given line of code you need to look up a class header or two and pray they are thoroughly commented.

      I'm not a disciplened programmer by any standard, being mostly self-taught, but I can still read through 3 or 4-year-old Perl programs that I wrote with ease. In addition, I've had someone with very little programming experience and no Perl knowlegde at all actually successfully debug one of my Perl scripts! (It was a couple hundred lines long to boot.) Their comment was that it was very easy to read. I also find other people's Perl code to be (usually) easy to read, especially when they make some reasonable stylistic choices and stick with them.

      This is intentional. Perl is designed by a linguist to read like English. A competent programmer will take advantage of this to write VERY readable code. It also borrows syntax from C, shells, sed, and awk. This gives it a fast learning curve and familliar appearance for Unix programmers. I don't know sed or awk, but thanks to Perl I can now read them to some extent.

      A lot of people focus on how Perl is not the absolute best programming language for this or that kind of job, but I find that it's extremely good at handling an enormous variety of tasks. It takes the blue ribbon for text parsing, and partly for that reason it's great for job control (automation or "glue"). It has such a rich library that Perl one-liners are often useful.

      It has simple yet powerful data structures and for that reason I use it a lot for simple data analysis. For numerical work, I use different tools depending on the complexity: Calculator -> spreadsheet -> Perl -> C++. Excluding the calculator (which for me is a Perl script I wrote), I'd say I use a spreadsheet 10% of the time, a Perl script 80% of the time, and C/C++ the remaining 10% when performance begins to matter. Oh I use Mathematica too, but strictly for symbolic computation. For numerical work, Mathematica is akward to program and inefficient beyond a fertile imagination!

      So while I don't think Perl is right for every task, it's definately readable (in practice) and it's nearly the best tool for a great many tasks.

      p.s. I learned Perl in '96 when I was doing a lot of programming in Fortran (not by choice!). Fortran is actually quite good for number crunching, but horrible for anything else. Perl is great for almost everything but number crunching (it's a bit slow there). So those two languages made for a nice, however odd, pair. My first Perl scripts would provide the command-line, GUI, or web-based interfaces to lots of Fortran executables.

    2. Re:Excuse me? by mekkab · · Score: 1

      Their comment was that it was very easy to read.

      Then maybe you are a better programmer than I was.

      I support everything you say in your post- its all true. Perl IS a great general purpose language.

      But when I went to knock off a quick script that would take text input and chop things at 80 chars per line and add line numbers, I had a dickens of a time remembering my perl and getting it to work. (it wasn't chopping properly) Without opening a manual I was able knock out a quick awk script to do the same.

      I'm not saying awk is better, I'm saying for simple text parsing FOR ME, awk is easier. And thats because I mostly use C and ADA (With some assembly thrown in for good measure) these days. I know a handful of shell scripting tricks and have my usual shell scripts that I make minor modifications to, and thats it.

      So for someone who doesn't use perl all the time (if I tried to use it as often as possible, that would amount to at most, 5% of my time. Probably less) I find it a PITA, even though a lot of its oddities are present in other scripting languages.

      --
      In the future, I would want to not be isolated from my friends in the Space Station.
    3. Re:Excuse me? by TopherC · · Score: 1
      I'll agree that Perl (or any programming language for that matter) does require somewhat regular use to keep it fresh. I guess I spend on average about 2 hours per week writing Perl. That's a very rough guess.

      Here's a Perl script to do what you want that's not too bad. I left out comments to be fair, but normally even for a tiny program like this I'd include a couple just to remind me what it's supposed to do and for a quick hint of what substr does:

      #! /usr/bin/perl

      $lineNum = 0;
      while (<>) {
      chomp;
      $first80 = substr($_, 0, 80);
      $lineNum++;
      printf "%3d: $first80\n", $lineNum;
      }

      To my mind, this alone is not bad. (Sorry the tabbing didn't come through.) No one in their right mind would remember the calling syntax of substr(), but that's what "perldoc -f substr" is for. In fact I even forgot about substr but the docs for "chop" refered to it.

      If you feel that this is too much code for such a simple task, it can be shortened to:

      #! /usr/bin/perl -n
      chomp;
      printf "%3d: %-.80s\n", ++$lineNum, $_;

      If you're up on what -n does (just try "perl -h"), and are a bit more comfortable with C's printf, this might even be easier to read to boot. And, it's a reasonable size to enter on the command line using "perl -e". But my first example tries to do just one thing at a time and that's crucial for readable code.

  14. Re:Best of Perl? by Anonymous Coward · · Score: 0

    So, uh, what does it do?

  15. CITE by MagicM · · Score: 0, Offtopic

    FYI: The close-tag for is not optional.

  16. No punctuation or spaces? by Pentagram · · Score: 0, Troll

    I think you mean that it would have been more readable to Perl users if it had been written in punctuation and spaces.

    1. Re:No punctuation or spaces? by mph · · Score: 0, Offtopic
      Welcome to Slashdot, where a little good-natured ribbing gets you moderated down as a "Troll."

      I bet these moderators are shocked and offended by a Jay Leno monologue.

    2. Re:No punctuation or spaces? by mondoterrifico · · Score: 0, Offtopic

      How the hell did this comment get moderated troll?!

      It's funny!

      If it needs to be explained to you, maybe you shouldn't have mod points on slashdot.

  17. Re:Best of Perl? by Anonymous Coward · · Score: 0

    perl -e 'print pack("H*","4675636b206f66662e")."\n"'

  18. Re:Best of Perl? by the_mad_poster · · Score: 1

    Highlights how not to write Perl code since there's no bang line, strict pragma or scope controls and the grandparent is relying on the obtuse open() call rather than using the FileHandle module which would've been much cleaner.

    Oh uh... and it does exactly what he thinks it does all the same, except for the last line may or may not print out. Ah, the power of Perl, TMTOWTDI:

    #!/usr/bin/perl -w
    use strict;
    use FileHandle;
    my $passwdFH = new FileHandle "/etc/passwd", 'r';

    print $_ while(<$passwdFH>);
    $passwdFH->close;
    Should do exactly the same thing. S'why Perl's great - do it however you want. I think my way is more elegant, but I also thing the original way was much clearer to the non-Perl slinger.
    --
    Alito: A vote for Alito is a punch in the eye to put that bitch back in her place!
  19. Re:Best of Perl? by Anonymous Coward · · Score: 0
    I know you are a troll but it prints the /etc/passwd file.


    #!/usr/bin/perl
    print "I know this is pretty hard to read so:\n";
    while (1) { print "Fsck off!\n";}


    Gee... I wonder what that does... it's so cryptic.
  20. Re:Best of Perl? by Anonymous Coward · · Score: 0

    Your OS : written in C
    Your Word processor : written in C
    Your Browser : written in C
    Your Email Client : written in C
    Your Spreadsheet : written in C

    J4v4/r00by/pyth0n/p3rl/vb R00lz, u 3litSt p1G !!!

  21. best of the perl journal? by Savatte · · Score: 0, Troll

    Is it blank? ;)

  22. Re:italics tag? by Anonymous Coward · · Score: 0
    Dahij hsals itna eht nioj

    Holy shit - when I first saw this I though /. was getting finally getting a bunch of otaku wanker trolls from SA.

  23. Re:Best of Perl? by sisukapalli1 · · Score: 3, Interesting

    The only reason for Perl's popularity is the elitists who get kicks out of other people not understanding their code.
    Perl encourages people to write very compact, easily readable code in perl. Ofcourse, some familiarity with basic syntax is needed. However, many people write code in perl just like they are writing AWK or C code.

    Just to contrast, have you seen any C++ code generated by Visual Studio? How would that code look to someone not familiar with the environment?

    Here is a cut down example of easy to understand code from the CGI page... well, lameness filter is complaining too much. Anyway, if you do perldoc CGI, you will see how it looks.

    S

  24. Re:You like communism, by Anonymous Coward · · Score: 0

    Communism. What is it all about... is it good, or is it whack?

  25. Re:Best of Perl? by Anonymous Coward · · Score: 0

    :-) All in good fun.

  26. Excuse you. by The+Ape+With+No+Name · · Score: 1

    I am sorry but if you are disciplined enough to write tight code always, it matters shit little what language you use. Yeah, Perl can be a mess, but what it doesn't waste on nonsense like coding style, it makes up for in spades in doing what you want it to do -- friggin time. Now that being said, I don't use Perl for everything. PHP is my web language now, but I'd be damned if I would write do something like SNMP data collection with anything other than Perl. The modules are there to make it easy and if I have to get crazy and parse snmpbulkwalks and such, it can do the job with out me worrying if I put a fucking tab in the right place.

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

      what you want it to do -- friggin time.
      well, only if you are using mod_perl... ;)

      I am sorry but if you are disciplined enough to write tight code always, it matters shit little what language you use.

      I can't agree. I've had some perl programs that were measly hundreds of lines of code. Strict pragma all the way. A couple of not-so-tricky RegEx's. The kid who "inherited it" couldn't figure it out so the project got shelved.

      I see kloc upon kloc of ADA code... and even "Confusing" state machine loops are a breeze (in comparison to understand.
      (that being said I find Text parsing in ADA to be a PITA and I'd rather do it in C!!! And I HATE text parsing in C!)

      Call it a dumbing down for the coding masses, and I won't disgaree with you. But for large project management and areas with high turnover or no "component experts" (the guy who designed and wrote it left) there are languages that are just easier to read. A lot of that has to do with coding standards and style. But enough also relies upon the language itself. Some people get confused when they see:
      My_array[ index++] = 12; /* a lil' C for ya */

      because you are doing two things at once. Should they be able to understand that? Absofrigginlutely. But if they don't have to worry about semantics, they can get right down to the domain specific problems with the code ("uhm, your code sets the webserver on fire. Stop that.").

      As for SNMP dumps, perl is nice cuz it can open the sockets and get the data. But if you gave me a dump ofthe data, I'd just as soon use awk to parse it out for off-line problem determination.

      me worrying if I put a fucking tab in the right place.

      GOD, I detest makefiles!

      --
      In the future, I would want to not be isolated from my friends in the Space Station.
    2. Re:Excuse you. by allolex · · Score: 1

      I can't agree. I've had some perl programs that were measly hundreds of lines of code. Strict pragma all the way. A couple of not-so-tricky RegEx's. The kid who "inherited it" couldn't figure it out so the project got shelved.

      Come on, either your code was poorly-written or the "kid" who took over maintenance wasn't competent. That's not intrinsic to the language.

      Some people get confused by their own native language. It doesn't mean there's something wrong with Kannada, or Bahasa Indonesia, or English.

      It comes down to having what is called an "ideal reader" in Literary Theory. You're writing with a specific ideal code maintainer in mind, and if your ideal reader's knowledge is not a subset of the real-word reader's knowledge, you've got a problem. So if you're dealing with substandard maintenance programmers, write the line that increments and assigns as two steps.

      --

      Allolex

  27. Re:Easy ways to get admin rights on NT servers! by Anonymous Coward · · Score: 0
    Doesn't this presuppose that the administrator of the box didn't properly secure logon.scr so that it can be overwritten with usrmgr.exe?

    So, they either need to rename or overwrite logon.scr and they need to copy or rename usrmgr.exe.

    Not that I'm saying that's not the out of the box config, mind you.

  28. Re:You like communism, by Anonymous Coward · · Score: 0

    Communism. What is it about?

    Is it good, or is it whack?

    In Soviet Russia, as follows:

    Communism. The Party tells me what it is about!

    It is good! Yes, very good!

  29. Re:Best of Perl? by aled · · Score: 0, Troll

    Oh yes, Perl encourages people to write code that Perl can easily read. For people is a little harder.

    --

    "I think this line is mostly filler"
  30. NOOOOOOOO! by The+Ape+With+No+Name · · Score: 1

    #!/usr/bin/perl -w
    #relax I'm just being a picky Perl person
    #I could be Christiansen and call you a godless moron ;-)
    use strict;
    open(FILE, "/etc/passwd) or die $!, "\n";
    while(<FILE>) {

    print $_;

    }
    close(FILE);
    exit;

    --
    Comparing it to Windows will be a moot point, since El Dorado is going to have a 40% larger code base than XP.
    1. Re:NOOOOOOOO! by Abcd1234 · · Score: 0

      So, you "use strict", and even run Perl with -w, no less, and then proceed to make use of Perl's implicit variables? Why does that strike me as amusing... :)

    2. Re:NOOOOOOOO! by SenorFluffyPants · · Score: 1

      You don't need the $_:

      open(FILE, "/etc/passwd) or die $!, "\n";
      while() {

      print;
      }
      close(FILE);
      exit;

      Or is that bad form?

    3. Re:NOOOOOOOO! by The+Ape+With+No+Name · · Score: 1

      Well, the discussion was about good coding practices of which strict pragma and -w are two examples. By the way, the above code doesn't run. I left a " out. Whoops.

      --
      Comparing it to Windows will be a moot point, since El Dorado is going to have a 40% larger code base than XP.
    4. Re:NOOOOOOOO! by Anonymous Coward · · Score: 0
      You know nothing about the ancient rites of Perl.

      #!/usr/bin/perl
      @ARGV="/etc/passwd";print<>

      which can be run on the commandline

      perl -e '@ARGV="/etc/passwd";print'

      or for the truly lazy;

      perl -pen '' /etc/passwd

      (another post nobody will read. sigh)

    5. Re:NOOOOOOOO! by Abcd1234 · · Score: 1

      Which is why I find it ironic. :) Although it's a matter of personal taste, I wouldn't consider the use of Perl's implicit variables a "good coding practice"... after all, there's nothing like inexplicable magic to keep the newbs confused. ;)

    6. Re:NOOOOOOOO! by Anonymous Coward · · Score: 0

      I read it.

    7. Re:NOOOOOOOO! by The+Ape+With+No+Name · · Score: 1

      It is part of the language. Why define a variable, then simple copy the implicit's value to that variable. Wasteful. The while() { print; } is elegant, but it is more nebulous to n00bs in that there is a real WTF factor involved. At least showing $_ will get someone to crack the Camel book to see WTF that is rather than try to understand how and why Perl tries to do it all for you if you want/let it.

      --
      Comparing it to Windows will be a moot point, since El Dorado is going to have a 40% larger code base than XP.
    8. Re:NOOOOOOOO! by Anonymous Coward · · Score: 0

      I read it

    9. Re:NOOOOOOOO! by Abcd1234 · · Score: 1

      Why define a variable, then simple copy the implicit's value to that variable. Wasteful.

      You're absolutely right. If you did this:

      while () {
      $line = $_;

      print $line;
      }

      That would be wasteful. Not to mention stupid. You would do this:

      while ($line = ) {
      print $line;
      }

      Which doesn't involve the implicit variable at all. Clearer, easier to read, no less efficient... what's the problem?

    10. Re:NOOOOOOOO! by Abcd1234 · · Score: 1

      Gah! Stupid HTML. Insert in those while() loops. :)

    11. Re:NOOOOOOOO! by Anonymous Coward · · Score: 0

      Because you are an idiot. Perl's "implicit variables" as you call them, are well documented and therefore explicit. Just cause you don't know jack doesn't mean other people are wrong.

    12. Re:NOOOOOOOO! by The+Ape+With+No+Name · · Score: 1

      OK. I agree that is more clear in readablity. But it just renames $_ to $file and shifts $_ to undef, so in the background there is something extra going on. For n00b, I'll I agree with you that this is a better thing. For me, yuck. ;-)

      --
      Comparing it to Windows will be a moot point, since El Dorado is going to have a 40% larger code base than XP.
  31. Re:HOW MUCH 4 TEH ARBYS SIGNATURE ROAST BEEF SANDW by Anonymous Coward · · Score: 0

    LOL, can you imagine the reaction of the Arby's drive thru worker? "Teh"? WTF is "teh"?

  32. Re:Not to be confused with... by ClippyHater · · Score: 1

    Only for completion.

  33. Re:Best of Perl? by Anonymous Coward · · Score: 0


    A shorter version might be:

    #!/usr/bin/perl -w
    system("cat /etc/passwd");

  34. Re:Best of Perl? by Mr+Bill · · Score: 1

    That looks more cryptic that it needs to be.

    use File::Slurp;

    print read_file( '/etc/passwd' );
  35. Re:Best of Perl? by the_mad_poster · · Score: 1

    Heh.. yeah, but if you wrap a single system call in a Perl or shell script, you should be shot.

    perl -e 'system "cat /etc/passwd"'
    --
    Alito: A vote for Alito is a punch in the eye to put that bitch back in her place!
  36. Re:Best of Perl? by the_mad_poster · · Score: 1

    I call shenanigans! File::Slurp is not a standard module! Cheater! Cheater! :p

    --
    Alito: A vote for Alito is a punch in the eye to put that bitch back in her place!
  37. Re:Best of Perl? by Anonymous Coward · · Score: 0

    Should read:

    based on limited personal experience.

  38. Re:Best of Perl? by Anonymous Coward · · Score: 0

    Perl isn't that bad! Most programmers should at least be able to read the following...

    #!/usr/bin/perl
    # Word counter -- takes in a text file, outputs
    # the frequency of each word found in said file.

    if ($#ARGV < 0) {
    print "Usage: $0 textfile [textfile2 ...]";
    exit;
    }

    while (<>) {
    foreach $word (split) {
    # Split the lines we ate from <> into words.
    # I.E. things separated by whitespace.
    if ($count{$word}) { # If it already exists.
    $count{$word} = $count{$word} + 1;
    } else {
    $count{$word} = 1; # First time seen.
    }
    }
    }

    foreach $word (sort keys %count) {
    print "$word occured $count{$word} times."
    }

    # Easy & nifty, no?

  39. Re:HOW MUCH 4 TEH ARBYS SIGNATURE ROAST BEEF SANDW by Anonymous Coward · · Score: 0

    I hear people say "teh". In the real world. They actually speak phrases like "teh suck". It scares the hell out of me.

  40. When is Perl 6 going to be released? by Anonymous Coward · · Score: 0

    In 2018? And why the fuck are they obsessing with the interpreter framework when the fucking language is not designed yet? Talk about poor planning.

  41. Re:Best of Perl? by Anonymous Coward · · Score: 0

    Might as well just be:

    #cat /etc/passwd

  42. Re:Best of Perl? by Camel+Pilot · · Score: 1


    Just to contrast, have you seen any C++ code generated by Visual Studio? How would that code look to someone not familiar with the environment?


    Ah yes, being familiar with the environment would help but it is still awful obtuse.

    I always thought Perl got a bad rap for encouraging bad hard to read style.

    I have worked with old C code so badly written that it was a nightmare to figure it out. It used massive global data via nested (and redundant) includes files. The original authors relied heavily on command precedence and so it as a challange to untangle a single line. And this was code written by a major defence contractor.

    But few complain about C propensity for obfuscation. Why is that? And C++ just ups the obfuscation ability a notch or two while significantly adding to the vocabulary.

    I suspect Perl's built in reg exp has been the result of most complaints. But a single reg exp can replace pages of code.

  43. Re:Best of Perl? by Anonymous Coward · · Score: 0

    I guess typing cat /etc/passwd would be too easy?

  44. Re:Best of Perl? by Anonymous Coward · · Score: 0
    No need for a module
    #!/usr/bin/perl -w
    undef $/;
    open (FILE, "/etc/passwd");
    $_ = <FILE>;
    print $_;
  45. Re:Best of Perl? by sisukapalli1 · · Score: 3, Insightful

    Some junior scripters and sysadmins that use perl probably haven't spent 1/100th time on "learning perl" as they would have spent on "learning C".

    Consequently, people get stuck with a very limited set of tools in the language, and (many are stuck in the perl4 syntax I believe), and write code accordingly. To a newcomer that reads such code, it becomes a nightmare.

    I found Visual Basic code written by someone very complicated. Turns out that the code was written in a very adhoc manner. Not being familiar with Visual Basic, I could have easily concluded VB is hard to read. Being mature :), I spent the time on asking for help and later easily understood the code.

    S

  46. Re:Best of Perl? by Anonymous Coward · · Score: 0

    Always, I mean ALWAYS,
    check return status of system calls!
    open(FILE, "/etc/passwd") or die "open err: $!\n";

  47. Re:Best of Perl? by Anonymous Coward · · Score: 0
    Why write so much ?
    #!/usr/bin/perl -nal

    $count{$_}++ for @F;

    END {
    print "$_ occurred $count{$_} times." foreach (sort keys %count);
    }
  48. poster-sized cover prints? by otis+wildflower · · Score: 1

    Anyone thought about doing a run of particular covers as posters?

    I'd particularly like the one where someone attempts to compile perl on a typewriter.. (underwood? I can't find it in a GIS..)

  49. I think I will get it by NightLamp · · Score: 1

    I always wanted a computer book ;-) this one seems like it would suit me. Then again I have blown more than a few Sunday mornings reading www.perlmonks.org

    Reading perl is almost as much fun as writing it. In it's more 'condensed' styles it is much more challenging (read: fun) to decode than java and the 'tmtowtdi' ethos sparks a lot of creative architectures.

    For me learning perl was/is more fun than any other language I have tried, those docs can be hilarious. They also help keep your spirits up during late night deadliners, I hope this book has some of that.

  50. Re:Best of Perl? by realdpk · · Score: 1

    perl modules are a bad way to go if you need any kind of performance. Your script takes over 10x as much CPU to run as the other poster's, the one that just did open(), while(), close(). .083 CPU seconds (on my pIII-600) for yours vs .009 CPU seconds for his. It might be more significant than this, actually, but it's hard to measure in much finer increments.

    Most of the additional time is the loading of the module. Watch:

    $ time perl -e 'use FileHandle;'

    real 0m0.102s
    user 0m0.083s
    sys 0m0.016s
    $ time perl -e 'use FileHandle;'

    real 0m0.099s
    user 0m0.075s
    sys 0m0.023s
    $ time perl -e 'use FileHandle;'

    real 0m0.099s
    user 0m0.089s
    sys 0m0.009s

  51. But the real question is... by But+Who's+Counting · · Score: 1

    ...why does Brad Murray need such a very big bed? (vol. III, authors) Wonderful books, by the way. Highly recommended, although you might want to browse them at your library or bookstore to see which one(s) interest you first.

  52. Re:Best of Perl? by pooh666 · · Score: 1

    Because everyone can understand the other guy's example and your code only makes you a smart ass. also known as the guy to fire because he things he is too hot.

  53. Re:Best of Perl? by Anonymous Coward · · Score: 0

    I don't agree.

    To someone who does perl for a living and is "good at what he/she does", the second example is much simpler to follow. It is more "perl-ish" and does not use unneeded variables.

    Once you get into the perl mindset, the second example isn't as bad as it looks.

  54. Re:Best of Perl? by eyeye · · Score: 1

    And thats why you should use something like mod_perl.

    --
    Bush and Blair ate my sig!
  55. Re:Best of Perl? by roie_m · · Score: 1
    That's not perl, but try feeding this into the perl interpreter for a surprise:
    #!/bin/sh
    cat /etc/passwd
  56. Re:Best of Perl? by pooh666 · · Score: 1

    Then it is already too late for you, its getting dark... dark....

  57. um, err... by justMichael · · Score: 1
    I really like perl for it's incredible text parsing and quick hackability...

    The problem people have with perl, including myself, is that if you ask 10 perl hackers to do the same task you are going to get back 10 completely different pieces of code.

    This can be an incerdible pain in the ass to deal with, espically if you have to maintain somebody elses code when they code in a completely different manner than you do. Consider this...
    while (something) {
    ...
    }
    and
    do {
    ...
    } while (something)
    I probably screwed up the syntax on the latter because I don't think you should have to scroll to the bottom of a block to see why you are executing it.

    So even if you are very familiar with perl you may see code that doesn't make any sense to you.

    perl truly is write once, read never code ;-)