Slashdot Mirror


Minimal Perl for Unix and Linux People

Ravi writes "Perl (Practical Extraction and Report Language) — the language which was created by Larry Wall is arguably one of the greatest programming languages. But it has a reputation for taking an excessive cryptic nature which gives it an image especially among Perl novices as a language which is complex and hard to master. Minimal Perl: for Unix and Linux people, authored by Tim Maher and published by Manning Publications addresses the obstacles presented by Perl's complexity. This book which is divided into two parts comprising of a total of 12 chapters takes a unique methodology to explain the Perl syntax and its use. The author emphasizes on Perl's grep, awk and sed like features and relys on concepts such as inputs, filters and arguments to allow Unix users to directly apply their existing knowledge to the task of learning Perl." Read on for the rest of Ravi's review. Minimal Perl for Unix and Linux People author Tim Maher pages 464 publisher Manning Publications rating 8 reviewer Ravi ISBN 1932394508 summary Provides a slice of Perl which when mastered can accomplish most of the jobs which require Perl What I found while reading this book is that the "Minimal Perl" is a specially crafted subset of Perl language designed to be easily grasped by people who have a Unix background and who wish to use Perl to write their scripts. Its aim is to filter out the complex way of writing programs using Perl and whenever possible to accomplish tasks using just one or two lines of Perl. In the first part of the book, the author explains how Perl can be used to do the same tasks as accomplished by common Unix tools such as grep, awk, sed and find. He goes one step further by explaining how one can accomplish much more and in a much simpler way by using Perl techniques.

Throughout the book, the author makes sure that the learning curve in acquiring Perl skills remain gentle. Perl is a language whose syntax has a multitude of options, this book is peppered with numerous tables which provide excellent information at a glance. For example, in the third chapter titled "Perl as a (Better) grep command", the author lists and compares the fundamental capabilities of Perl and the different grep commands such as grep, egrep and fgrep which clearly shows the advantages that Perl has over grep. In another table, you get a birds eye view of the essential syntax of Perl's regular expressions and their meaning. This chapter alone has around 12 tables. This is a really nice feature because it doubles as a Perl reference where you can flip to the respective page and get the information you need.

The main strength and drawback of a language such as Perl is its dependence on regular expressions for accomplishing complex tasks. Once you master the regular expressions, the sky is the limit for ordering and segregating data using this language. In Perl, there is more than one way of doing the same thing. What is unique about this book is that the author specializes in explaining the easiest way of doing a particular task.

In many places, the author demonstrates complex tasks using just a few lines of Perl code. Many of the examples covered in this book are practical examples which give an idea of how the commands relate to the final outcome. For instance, while elaborating on the one line grep like commands in Perl, the author illustrates a web oriented application of pattern matching where he shows how to extract and list, the outline of slashdot.org site's front page. The surprising thing is this is accomplished using just a single line of Perl code. This book has lots of such one line examples which teache how to use Perl intelligently using minimal effort.

If part I of this book focuses on ways in which simple Perl programs can provide superior alternatives to standard Unix commands, the second part throws light on the other aspects of Perl concentrating on the syntax of the language and various built-in functions and modules available which do away with a lot of re-invention of the wheel, so to speak, and helps churn out code which is portable.

Chapter 7 titled "Built-in functions" introduces an eclectic mix of functions available in Perl. You have functions which are used to extract a list of fields from a string, functions to access the current date and time, generating random numbers, sorting lists, transforming lists, managing files with functions and so on. These functions are broadly classified into those which generate and process scalars and those that process lists.

In chapter 8 of this book, the author involves the reader on the numerous scripting techniques that can be used to write better Perl programs.

It was quite surprising that the author has chosen to discuss the variables, more specifically the list variables comprising of arrays and hashes, as well as the looping constructs only in the 9th and 10th chapters, when they should be somewhere up front. In hind sight, I feel it is a good decision. Once you execute the one liner Perl programs in the initial chapters, you will be fairly confident in using Perl by the time you reach the 9th chapter.

The last two chapters deal with creating sub-routines and modules. Over the years various Perl programmers have created modules which are used for diverse purposes. With an aim to share these modules, they are collected and stored at one central place known as CPAN, which is an acronym for Comprehensive Perl Archive Network. The final chapter, apart from teaching how to create modules in Perl and manage them, also introduces the CPAN and ways in which one can find the right module by searching on CPAN.

The special variables cheat-sheet and the guidelines for parenthesizing code provided in the two appendices are really useful as a quick reference while writing Perl programs.

This is not a comprehensive book on Perl, rather the author provides a slice of Perl which when mastered can accomplish most of the jobs which require Perl. You won't find object oriented concepts of Perl being mentioned in this book. In many ways the author has moved beyond explaining a subset of Perl by providing a section titled "Directions for further study" at the end of each chapter, where the author lists further material which can be used to learn more about the topic that is covered.

I really enjoyed going through this book, especially because of its focus on the practical side of using Perl and taking a minimal approach.

Ravi Kumar maintains a blog titled "All about Linux" where he shares his thoughts and experiences in using Linux, Open Source and Free software.

You can purchase Minimal Perl for Unix and Linux People from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

332 comments

  1. Minimal Perl for Unix and Linux People by mobby_6kl · · Score: 2, Funny

    Minimal Perl for Unix and Linux People? Is this the result of a perlgolf competition between perl-related books?

  2. *sigh* by A+beautiful+mind · · Score: 4, Funny

    Perl (Practical Extraction and Report Language)
    That's a backronym. By those standards you could also call PHP Pretty Hellish Performance.
    --
    It takes a man to suffer ignorance and smile
    Be yourself no matter what they say
    1. Re:*sigh* by Timesprout · · Score: 3, Insightful

      Na, theres nothing pretty about PHP

      --
      Do not try to read the dupe, thats impossible. Instead, only try to realize the truth
      What truth?
      There is no dupe
    2. Re:*sigh* by swordgeek · · Score: 2, Informative

      Honestly, it doesn't matter. The cart came before the horse in this case, but regardless of its acronymic meaning (or lack thereof) when it was created, Perl DOES now stand for Practical Extraction and Report Language. Just ask Larry Wall.
      Remeber that a "Backronym" (hate that word!) is a subtype of acronym.

      --

      "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
    3. Re:*sigh* by croddy · · Score: 3, Interesting

      Steve Wilhite also tells us that "GIF" should be pronounced like "JIF". Don't let these erroneous claims fool you just because they come from the authors.

    4. Re:*sigh* by Nefarious+Wheel · · Score: 1

      I thought it was "Perl Hates Programmers"?

      --
      Do not mock my vision of impractical footwear
    5. Re:*sigh* by NoOneInParticular · · Score: 1

      But, what happened to "Pathetically Eclectic Rubbish Lister"?

    6. Re:*sigh* by infaustus · · Score: 1

      He also gives equal support to the "pathologically eclectic rubbish lister" expansion.

      --
      Frosty piss posts are worthless, GNAA posts are worthless and hurtful, but they are the least of this site's neuroses.
    7. Re:*sigh* by grcumb · · Score: 4, Funny

      Perl (Practical Extraction and Report Language)
      That's a backronym. By those standards you could also call PHP Pretty Hellish Performance.

      ITYM 'Poorly Hung Perl'. 8^)

      --
      Crumb's Corollary: Never bring a knife to a bun fight.
    8. Re:*sigh* by rrhal · · Score: 1

      What happened to "Pathologically Eclectic Rubbish Lister"?

      --
      All generalizations are false, including this one. Mark Twain
    9. Re:*sigh* by arodland · · Score: 1

      Larry also says that it stands for "Pathologically Eclectic Rubbish Lister" and wears a shirt that says "Polymorphic Existential Recursive Lambda 6". It doesn't mean that Perl "stands for" those things, merely that the letters of its name can be put into correspondence with the word-first letters of those phrases. This is especially relevant in light of the fact that Perl is not and has never been an acronym. Unless you count P.E.R.L., anyway.

    10. Re:*sigh* by uhlume · · Score: 1

      Ridiculous. Everyone knows it stands for Poor Excuse for a Real Language.

      --
      SIERRA TANGO FOXTROT UNIFORM
    11. Re:*sigh* by arivanov · · Score: 2, Interesting

      I like debian description better: $ dpkg --status perl-base | grep Description Description: The Pathologically Eclectic Rubbish Lister While at it, there is no such thing as minimal perl. It is the most addictive language I know. Once you are hooked, you are hooked. Seen it many times.

      --
      Baker's Law: Misery no longer loves company. Nowadays it insists on it
      http://www.sigsegv.cx/
    12. Re:*sigh* by ebassi · · Score: 1

      that's "Perl for Hopeless Programmers".

      --
      You can save space. Or you can save time. Don't ever count on saving both at once. -- First Law of Algorithmic Analisys
    13. Re:*sigh* by pclminion · · Score: 2, Interesting

      Steve Wilhite also tells us that "GIF" should be pronounced like "JIF".

      Which is exactly how everybody I know pronounces it.

      Let me guess: when you say the word "laser," you pronounce the s with a "zzz" sound, right? Except the "S" in laser means "stimulated," not "ztimulated!" See, you're pronouncing laser wrong!

      A more reasonable conclusion would be to say that the sound of a letter in the pronunciation of an acronym need not relate to the sound of that letter in the word from which it derives.

    14. Re:*sigh* by noldrin · · Score: 1

      I always pronounced it gif, because when I first saw it, sometimes JPEG files had the extension JIF for, JPEG Interchange Format. Unless perhaps the authors of that are Hispanic and we are suppose to pronounce it 'hif' but then we'll probably have to pronounce JPEG 'heypeg' which would be amusing.

    15. Re:*sigh* by CaseyG · · Score: 1

      Choosy perverts choose GIF.

      (Yes, I'm dating myself. It's not like anyone else here will.)

        -c.

      --
      Casey

      More scratches on the cave wall, thanks be to anonymity.

    16. Re:*sigh* by croddy · · Score: 1

      Boy howdy, you sure know how to kick the shit out of a straw man.

    17. Re:*sigh* by swordgeek · · Score: 1

      Absolutely BRILLIANT bloody response! Best thing I've read on /. in weeks, if not months or years!

      Thanks, I needed that.

      --

      "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
    18. Re:*sigh* by swordgeek · · Score: 1

      And you win...

      Runner up for best comment of this thread! Congratulations!

      Seriously, that was pretty good. And I'm old enough to remember why it's funny.

      --

      "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
  3. PERL backronym by Anonymous Coward · · Score: 0

    Yeah...doesn't really mean what the summary says (the name itself)

    [wikipedia]
    The name is occasionally given as "PERL" (for Practical Extraction and Report Language). Although the expansion has prevailed in many of today's manuals, including the official Perl man page, it is merely a backronym. The name does not officially stand for anything. Spelling PERL in all caps is therefore considered a label of community outsiders. Several other expansions have been suggested, including Wall's own humorous Pathologically Eclectic Rubbish Lister.

    Indeed, Wall claims that the name was intended to inspire many different expansions.

    1. Re:PERL backronym by morgan_greywolf · · Score: 5, Funny

      Nope.

      Stands for Python'll Eventually Replace this Language.

      or, optionally:

      Perl Eats Ruby for Lunch :-D

  4. Re:Cheaper at Amazon. by Lockejaw · · Score: 1, Troll

    Congratulations, AC, you've discovered that used books are cheaper than new ones.

    --
    (IANAL)
  5. So you like the book by NaCh0 · · Score: 1

    But give it an 8/10. Care to explain why? The only thing I see in your review is a poor assumption that in hindsight you agree with.

    1. Re:So you like the book by realmolo · · Score: 4, Funny

      8/10 is a *good* review. You've been reading too many IGN game reviews.

      IGN scoring works like this:

      5/10 - The game runs

      6/10 - The game is an FPS

      7/10 - The game has team-based mulitplayer online play

      8/10 - The game runs at 190 frames-per-second

      9/10 - The game is made by a publisher that buys advertising on IGN

      10/10 - The game is made by a publisher that buys A LOT of advertising on IGN
       

    2. Re:So you like the book by NaCh0 · · Score: 1

      No, I don't play video games at all.

      I see the rating as 80% good, 20% bad.

      I'd like to hear about the 20% bad side to balance the glowingly positive side he posted.

    3. Re:So you like the book by quintesse · · Score: 1

      That's silly, it would not give you any opportunity anymore to give higher notes. Imagine that you can't find any flaws in the book, according to you that means he would have to give it a 10. Then next week another book comes out that is way better in lots of aspects.... what to do now? Give it an 11?

      Writing book reviews is not an exact science, you can hardly make some kind of formula and get a meaningful result, so maybe what he uses is something like this (just an example):

      4 - book contains incorrect information and/or is generally badly written
      5 - book is not bad but misses information in some key areas
      6 - book is okay but nothing special either
      7 - book is well written, does not contains any obvious mistakes, covers all key areas
      8 - book is really well written, knows how to explain difficult subjects
      9 - book is extremely well written, gives insight and makes complex subjects seem almost easy
      10 - after reading this book you can call yourself an expert and won't need to read any more books on the subject

    4. Re:So you like the book by maxwell+demon · · Score: 1

      4 - book contains incorrect information and/or is generally badly written

      Hmmm ... if that's already a 4, then what are 1 to 3?
      Maybe:
      3 - book contains only incorrect information and is generally badly written
      2 - the book is so badly written that it's impossible to determine if the information is correct
      1 - trying to read the book will cause severe damage to your brain
      --
      The Tao of math: The numbers you can count are not the real numbers.
    5. Re:So you like the book by acidrain · · Score: 1

      Trick is to *actually read* the review and not allow any gushing along the lines of "amazing book/game with just a few flaws" to blind you to the criticisms that will still be there regardless of how much advertising the publisher buys.

      E.g. use metacritic to get a feel for it's overall quality (80% is ok, 83% is good, over 86% is excellent) and then read IGN for any downside that resonates even slightly with you.

      --
      -- http://thegirlorthecar.com funny dating game for guys
    6. Re:So you like the book by dotgain · · Score: 1

      Then next week another book comes out that is way better in lots of aspects.... what to do now? Give it an 11?
      It's one louder!
    7. Re:So you like the book by Marcos+Eliziario · · Score: 0, Flamebait

      1 - trying to read the book will cause severe damage to your brain
      You mean... the book was written in PHP, or Visual Basic?

      --
      Your ad could be here!
  6. Re:Cheaper at Amazon. by Anonymous Coward · · Score: 0

    Among the "Used and new..." listings there are just as many new books--sold by dealers affiliated with Amazon but able to offer a lower price than them--than used copies.

  7. Cryptic? Complex!? by setirw · · Score: 5, Funny

    But it has a reputation for taking an excessive cryptic nature which gives it an image especially among Perl novices as a language which is complex and hard to master.


    So wrong! Just look at the following example:

    #!/usr/bin/perl -w

    length q caller vec and print chr oct ord q qx eq and print chr ord q ref or and print chr ord q or no and print chr ord q else and print chr ord qq q q and print chr ord q tie gt and print chr ord qw q sin q and print chr ord q q eq and print chr ord qw q sin q and print chr ord q sin s and print chr ord q cmp lc and print chr ord q split s and print chr ord qw q lc q and print chr ord q ne sin and print chr hex length q q bless localtime ref q


    Run that. Nothing cryptic or complex at all.

    (BTW, it prints "Perl is simple!")
    --
    This message printed on 100% post-consumer recycled electrons.
  8. Python by Anonymous Coward · · Score: 0, Flamebait

    Just use Python. It is a far superior language. Perl is for fags.

    -- Larry Wall

    1. Re:Python by licious · · Score: 1, Funny

      crap, I was wondering why Tom Cruise, John Travolta and R Kelly were with me in this smallish room filled with coat hangers and ties.

      --
      I hear there's rumors on the Internets that we're going to have a draft.
    2. Re:Python by eneville · · Score: 1

      crap, I was wondering why Tom Cruise, John Travolta and R Kelly were with me in this smallish room filled with coat hangers and ties. ... tom cruise, john travolta and r kelly won't come out of the closet ...
  9. I {} Perl by Cally · · Score: 4, Interesting
    perl has paid my rent and bought me more of the special, special tea from high in the Himalayas that enabled me to understand it so easily in the first place. I find myself speaking it in my sleep (and yes, you do speak Perl, just as you program in C.) It's a matter of some puzzlement to me that the loathesome homunculous that is PHP supplanted Perl as the preferred language for non-ASP web programming. (And ASP..? Don't get me started!!) I wrote my first code many years before discovering Perl, but it was Perl that turned me into a programmer. To me, you cannot claim to know Unix until you can read Perl (in both directions - in and out.)

    That is all...

    --
    "None are more hopelessly enslaved than those who falsely believe they are free." -- Goethe
    1. Re:I {} Perl by timster · · Score: 4, Funny

      "Speak" Perl, right. Because what Unix really needed was a combination of the specificity of natural language and the friendly syntax of awk.

      --
      I have seen the future, and it is inconvenient.
    2. Re:I {} Perl by Anonymous Coward · · Score: 0

      I'm glad you are able to pay your rent. However, Perl has nothing to do with UNIX. UNIX ran just fine before Perl and works fine without it now. There are many who know UNIX quite well. Even though they've never used or read Perl code.

    3. Re:I {} Perl by Phroggy · · Score: 1

      It's a matter of some puzzlement to me that the loathesome homunculous that is PHP supplanted Perl as the preferred language for non-ASP web programming. PHP is friendlier for beginners in two important ways: first, perl borrows heavily from existing C and UNIX syntax; anyone who already knows C and wants to calculate tomorrow's date will feel right at home with localtime(), but the newbie will find PHP's date functions far easier, for example. Also, perl's syntax is vastly more complex than PHP's, and language syntax isn't something you can just look up in a reference when you're not sure what something does. In PHP, once you learn the basics, anything you see that you don't understand, you can just look up the function name. In Perl, when you see something you don't understand, chances are you don't even know what you're looking at.

      #!/usr/bin/perl
      ($n,$s)=('phroggy',join'', map{(sort split'','b_jl msepr$hyacn"otg.')
      [$_]}map ord()-97=>split'' =>'shfmfrajitkpstguofniabcedlfqkdcodhpnb')
      and print eval $s for(0..6);
      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    4. Re:I {} Perl by Cally · · Score: 1

      Yes, yes, yes, but don't distract me with these pettyfogging facts. The joy and euphoria I felt when I got over the lip of the curve and realised that I had the simple, simple key to parsing obfsucated C sig one-liners like yours just can't ever be found in PHP. Yes, PHP might make it easy to do the easy things, but there'll never be a PHP one-liner sig, because there's no joy in Perl.

      --
      "None are more hopelessly enslaved than those who falsely believe they are free." -- Goethe
    5. Re:I {} Perl by Anonymous Coward · · Score: 0

      To know unix quite well and to automate its daily chores are two completely different things.

      You can talk about the intracacies of the /proc filesystem or signal handling or loadable kernel modules, but to be a system admin requires a vastly different skillset.

      Hacking at a 5000+ line shell script is not unheard of, but somewhere around 223 lines it becomes a very good idea to consider using another language. Something scalable, with a large collection of libraries to automate many basic tasks. Say, Perl.

      For many sysadmin tasks, Perl (backed by CPAN) is often times the right tool for the job.

    6. Re:I {} Perl by Anonymous Coward · · Score: 0

      I know unix quite well, by virtue of having learnt unix and c at the same time (and my continuing love of both).
      I don't know perl - that is to say, I only just learnt what the term 'perlgolf' means. I could belt out a 99 bottles of beer in perl, but anything else would be beyond me. I've never really had a need to learn more than the basics of perl, although I can certainly see that knowing it well would only enhance my unix experience.

      Any particular reason why an admin must use perl? There are many other tools for automating things. Perhaps I've never had the 5000+ line shell script problem...

    7. Re:I {} Perl by jsdcnet · · Score: 1

      Don't get me wrong, I love perl, but way back when I was making the decision to steer the company to mod_perl or mod_php, there was no choice. mod_perl was so clumsy and had so many limitations, it felt like what it was: an awkward attempt to shoehorn perl into an apache module. php may have its problems but at least it was designed from the beginning to be an apache module. (I haven't used mod_perl in a long time so it may be the bees knees' now, but I'm sure a lot of folks were planning big sites around the same time I was and this may be part of the explanation as to how php achieved dominance.)

      --
      no longer working for cnet
    8. Re:I {} Perl by Anonymous Coward · · Score: 0

      ... but somewhere around 223 lines it becomes a very good idea to consider using another language.

      And so you propose Perl, known for its easy maintenance and high-readability.

      But, anyway, as my shell scripts are maximum 222 lines long I suppose I'm fine ;)

    9. Re:I {} Perl by Phroggy · · Score: 1

      Did you mean to say there's no joy in PHP?

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    10. Re:I {} Perl by Eivind+Eklund · · Score: 1
      I know Perl, I can read it in both directions, I know the magic of the typeglobs and the XS and the various geekery that goes on. It has paid my rent more days than any other language. I can read it in both directions. I think it is time for it to go to its resting place, with its kids (Ruby, Python) taking over, with their ability to do most of the same things, cleaner, clearer, and more consistently.

      Eivind.

      --
      Doubting the existence of evolution is like doubting the existence of China: It just shows that you're uninformed.
    11. Re:I {} Perl by mbrod · · Score: 1

      I wrote my first code many years before discovering Perl, but it was Perl that turned me into a programmer.

      Me too. I took a Fortran class in college that had a not so exciting teacher and just couldn't stand it. I swore I would never be a programmer.

      Once starting my professional carrear I had a few tasks I needed to accomplish and someone suggested trying Perl. In really the first few hours I was hooked. After seeing how you really could solve real world problems quickly with the language I learnt other languages and now have been a programmer professionally for about 10 years.

      I would like to see colleges offer courses for programmers, business people and scientists in Perl. It only takes a few hours to get rolling and it has so many applications for solving little problems quickly in all these fields.

    12. Re:I {} Perl by Cally · · Score: 1

      foreach (reverse (keys( %{$_} ){ ...

      --
      "None are more hopelessly enslaved than those who falsely believe they are free." -- Goethe
    13. Re:I {} Perl by Phroggy · · Score: 1

      Perl:
      foreach my $key (reverse keys %foo) {
          print "$key = $foo{$key}\n";
      }


      PHP:
      foreach (array_reverse($foo) as $key => $value) {
          print "$key = $value\n";
      }

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
  10. the book looks very relevant by keshto · · Score: 2, Interesting

    I use Python for most of my real scripting needs (i.e. any script that goes into a file and is over 10 lines long). I find Python to be a much easier language to think in and write. The biggest attraction of Perl for me is as a better awk and sed. Almost all of my Perl uses are of the sort "perl -pe 'xxxx'" . It seems the book is aimed at users like me.

    1. Re:the book looks very relevant by brunson · · Score: 1

      Perl is the vise-grips of programming languages, and as my Dad always told me, "There's a right tool for every job and it's almost never vise-grips".

      --
      09F911029D74E35BD84156C5635688C0
      Jesus loves you, I think you suck
    2. Re:the book looks very relevant by runningduck · · Score: 1

      I use Python for most of my real scripting needs (i.e. any script that goes into a file and is over 10 lines long).

      Me too, but all my scripts end up with less than 10 lines in Perl so I never make it to Python.

      --
      -rd
  11. Should I read this or continue with sed/awk? by RiotXIX · · Score: 2, Insightful

    Useful review.

    I'm currently going through http://www.oreilly.com/catalog/sed2/, but I can see my using perl the more I do website programming. Would an experience scripter suggest that I switch to perl (for it seems it can perform similar text manipulation functions conveniently in a programming lanuage), or spend more time with sed/awk?

    I'll probably do both incidentally, but opinions would be appreciated. It seems everyone rates perl.
    I was going to switch to Python, but apparently Perl is better for smaller/one line regexp manipulation in scripts, and python for building large applications.

    --
    "You know you don't act like a scientist, you're more like a game show host." Dana Barret
    1. Re:Should I read this or continue with sed/awk? by CRCulver · · Score: 3, Informative

      I don't want to put Perl down, but I think that its day is past except for those who, because they learnt it when it was the only thing around, are willing to tolerate its eccentricities. While switching from sed/awk to a general-purpose programming language with good text manipulation abilities can certain improve the possibilities of what you can accomplish with a single chuck of code and processor (as opposed to the old-time Unix way of piping), I'd recommend Python for that, getting started with a guide like Mertz's Text Processing in Python (Addison-Wesley, 2003). Python is now as mature, if not more, in the realm of text processing as Perl was when its won its accolades a decade ago. (Heck, the treatment of Unicode is enormously forward-thinking compared to any other scripting language on the market.) And so you get the same power as you would with Perl, but much, much more readable.

      I fear I'm starting a holy war by recommending Python in a Perl discussion. That's certainly not my intention. For those who already know and love Perl I say, great, keep on trucking. But I just can't see the point in steering newbies towards it.

    2. Re:Should I read this or continue with sed/awk? by chromatic · · Score: 2, Interesting

      Because Perl is a general purpose programming language, it can do a lot more than sed or awk. Learning all three is useful if you do a lot of Unix administration or command-line work, but you can get by with Perl alone if you only learn one.

      ... apparently Perl is better for smaller/one line regexp manipulation in scripts, and python for building large applications.

      It depends on the application. I appreciate perl2exe (though I've heard good things about PAR and wxPython has better documentation than wxPerl, but Perl also has the CPAN. I've had no small success building large applications in Perl.

    3. Re:Should I read this or continue with sed/awk? by tknd · · Score: 3, Interesting

      Yes and no.

      I don't have much experience with sed and awk so I'm not sure what you plan on using perl for. The basic answer is you need to use the right tool for the job but I don't know what job you have so I can't directly answer your question.

      Perl is pretty good with text manipulation due to it's built-in and extensive support of regular expressions. It's also got most programming language features so you can extend it and use it for larger tasks or even create real software all in perl. Perl also has a very large module repositor (cpan.org) where you can find all sorts of modules written by tons of authors to access databases, parse and generate http headers, access image manipulation libraries, and so on.

      Perl can do a lot but there are downsides to that. Because there are so many different approaches and so many different tools and features in the language, you have to learn a lot in order to understand a lot and it can cause some unnecessary implementations that are either too complex, too hard to read (and maintain), or error prone. I've been using perl for quite sometime now (years) and I still see something new whenever I browse someone else's source. In addition, there are many features of the language that I still don't know how to use or I know how to use them but I refuse to use them because it makes the code harder to read. My basic advice here is if you do not have the self-discipline to keep your code clean, perl probably isn't for you because your code can easily get ugly if you're not careful.

      Some people like that but there are significant trends even in the perl community for cleaner syntax and elegant solutions. For example, take a look at Moose in cpan and if you have any object oriented programming experience it is a pretty interesting read. Also, if you do choose to try perl, start with the 'use strict' pragma and other safety features like function prototyping to ensure correct parameter passing and 'my' variable declarations. The use of those things alone will dramatically make it easier to maintain and debug your code.

    4. Re:Should I read this or continue with sed/awk? by Bluesman · · Score: 2, Interesting

      Like Java, the strength of Perl is in its libraries and its popularity. Unlike Java, Perl has support for a decent set of built in data structures, and the built in regular expression syntax is second to none.

      Perl's greatest strength is CPAN, which is a library of perl modules that handle just about any programming task that you can think of, and then some. Sometimes, it's uncanny how well certain modules fit your problem -- you can almost guess the names based on what you want. (need to find the size of an image? Try Image::Size.)

      In my opinion, Perl's syntax is awful. Because it doesn't have a context-free grammar, and many lines are ambiguous unless you're actually running a Perl program, writing a syntax highlighter for Perl is all but impossible. Another annoyance is having to use the different symbols like @ and % to denote variable type, and the reference/dereference syntax looks like comic book swear words. So, it's not "typing friendly." That's its biggest weakness.

      But really, the syntax of a language is such a small part of the overall picture that it's not worth worrying about too much. Finding a CPAN module that does exactly what you need more than makes up for any time you spend struggling to learn the syntax.

      You can't beat Perl for web programming. I just wish it were half as well supported as PHP seems to be on the cheap web hosts.

      --
      If moderation could change anything, it would be illegal.
    5. Re:Should I read this or continue with sed/awk? by _|()|\| · · Score: 1
      Would an experience scripter suggest that I switch to perl ... or spend more time with sed/awk?

      There are two good reasons to learn sed and/or awk: portability and history. Although Perl may seem ubiquitous, you wouldn't use it in a cross-platform (i.e., Solaris, AIX, Tru64, HP-UX, etc.) install script. Since Perl is in some ways inspired by sed and awk, knowing them may help you to appreciate Perl. Otherwise, I wouldn't spend too much time on them.

    6. Re:Should I read this or continue with sed/awk? by archen · · Score: 1

      As someone who has done quite a bit of perl (and still does) I'd say I'd have to agree that perl's sytnax needs work. I'm not very hip on the changes that will be comming in perl6 however so I decided to jump ship totally and switch to ruby.

      Ruby can do most everything perl can do (including one liners), but once you've used perl, you will sorely miss CPAN. That and the ruby cgi library is junk, although good enough for simplistic cgi work.

    7. Re:Should I read this or continue with sed/awk? by clem.dickey · · Score: 1

      I gave up sed and awk for perl because I grew tired of silly limitations: 2048 chars per line in sed, 300 chars per line and 300 fields in awk. Implementations could increase them, and probably have, but Perl avoids artificial limits as a matter of principal.

      Nothing against Python though. I like the fact that the Python specification is about 80 pages, while the Perl specification is loosely spread throughout the 1000-page Camel book.

      I wouldn't forget sed entirely. The Liinux Filesystem Hierarchy Standard requires sed and sh in /bin, but does not require perl or python.

    8. Re:Should I read this or continue with sed/awk? by halivar · · Score: 1

      you wouldn't use it in a cross-platform (i.e., Solaris, AIX, Tru64, HP-UX, etc.) install script

      I've used it for just such a purpose, quite successfully. But I suppose it depends on the shop you're working with. In ours, we had the same version of Perl on all the Unix and Linux machines, so moving the scripts around was cake.

      The shell scripts, on the other hand...
    9. Re:Should I read this or continue with sed/awk? by clem.dickey · · Score: 1

      Should read *3000* characters per line in awk.

    10. Re:Should I read this or continue with sed/awk? by dramaley · · Score: 1

      I've been working with Perl in some fashion for close to a decade. I occasionally use sed or awk, but have not mastered them. So bear in mind that my differing level of experience with the different tools most certainly clouds my judgement.

      I would recommend you move up to Perl. Whenever i have to use sed or awk i find them to be quite limiting. Regular expressions don't seem quite as powerful as those in Perl (and if you can master Perl's regular expressions you'll probably love the language). Some of the basic Unix utilities are also noticeably slower than Perl. A few weeks ago i was searching for some plain strings in a very large (multiple gigabytes) file, and naturally i used grep. But grep was taking a very long time. I switched to processing the file with a trivial "perl -ne 'print if /regex/'" and the search went several times faster. I'm not sure why grep has a slow regular expression parser. I have not tested performance of sed and awk against Perl, but i'd not be surprised if they do not fare well either.

      That said, if Python is more your thing, go for it. I've wanted to learn Python, but i've gotten used to Perl's CPAN. The other thing that keeps me on Perl is its regular expression parser is so powerful. I've tried doing regex in other languages and it always seems painful by comparison.

      I wouldn't say that Perl isn't suited for larger applications. I've written a few multi-thousand line applications that are still easy to maintain. Granted, depending on what you are doing, a few thousands lines might be small to you. For the programming i do (system administration stuff mostly), full applications like that are rather large.

      --
      ----- "I'm still sane on three planets and two moons."
    11. Re:Should I read this or continue with sed/awk? by Tet · · Score: 1
      Perl's greatest strength is CPAN

      Perl's greatest weakness is CPAN, which makes deployment of perl code onto any halfway sane production server all but impossible.

      --
      "The invisible and the non-existent look very much alike." -- Delos B. McKown
    12. Re:Should I read this or continue with sed/awk? by doom · · Score: 1

      CRCulver wrote:

      I don't want to put Perl down, but I think that its day is past except for those who, because they learnt it when it was the only thing around, are willing to tolerate its eccentricities.

      Oh come on, the reasons to stick with perl are (1) the huge code base available on CPAN and (2) the perl programming culture.

      Perl culture is in great shape at the moment, in my opinion. The most annoying people in the world have all switched to Python, and the dull, money-grubbing bastards are all off plodding through Java... the only "dark spot" on the horizon is Ruby, which might actually suck up enough energy someday to bleed off interest in doing perl work.

    13. Re:Should I read this or continue with sed/awk? by notwrong · · Score: 1

      Oh come on, the reasons to stick with perl are (1) the huge code base available on CPAN and (2) the perl programming culture.

      These are great strengths of Perl. Perl has an active community with a great vibe, and CPAN has a wealth of code to do all manner of things. I guess the question for each hacker is whether the existing code on CPAN will be more of a help to you than the language's eccentricities will be a hindrance. I have found I only miss CPAN occasionally, but then I am doing research and many things I need aren't on CPAN anyway.

      The most annoying people in the world have all switched to Python

      Heh, I guess I'm one of the most annoying people in the world then. Are you sure it's not just that the grapes are probably sour anyway?

    14. Re:Should I read this or continue with sed/awk? by EatAtJoes · · Score: 1

      This relates to just the awk part, but I found that awk chokes on an apparently arbitrary number of records in a file. I wrote a logfile analyzer and awk would silently exit after 100k-200k lines; it would then go to the END {} block as though nothing was wrong, f**king up my stats. This happened on GNU/Linux and Solaris, nawk, gawk and awk.

      I switched to perl and never went back after that. I'm interested in this book for this very reason. My experience with perl had always been cgi plus a command-line utility here and there, but I feel like I never really "got" perl until I treated it like awk. (It's also when I stopped 'use strict', since half of the fun of awk is creating hashes on the fly, which of course perl can do but better). I was really amazed, actually, how much perl is like awk if you want it to be.

      I actually kind of hate sed, but then again I'm rarely changing text but usually searching through it, so I suppose I was misusing it. I did enough emacs S/Ring to understand sed's horrible regexps, but again, after perl (and java, which copied perl), I never will go back.

      I would say if you enjoy awk (and maybe sed), you'll love perl.

    15. Re:Should I read this or continue with sed/awk? by doom · · Score: 3, Funny

      The most annoying people in the world have all switched to Python
      Heh, I guess I'm one of the most annoying people in the world then. Are you sure it's not just that the grapes are probably sour anyway?

      Well, I didn't mean that to be taken personally... but consider the fact that ESR is on your side.

    16. Re:Should I read this or continue with sed/awk? by notwrong · · Score: 1

      Well, I didn't mean that to be taken personally... but consider the fact that ESR is on your side.

      Egad, you're right! Is it too late to come back?

    17. Re:Should I read this or continue with sed/awk? by runningduck · · Score: 1

      Everybody here knows that Perl is great for text processing but horrible for web sites. I'll bet people on Slashdot cannot even name one popular website written in Perl. :p

      --
      -rd
    18. Re:Should I read this or continue with sed/awk? by chthon · · Score: 1

      I now program severn years in Perl, and yes, I have to tolerate its eccentricities, but for me the only language I would be willing to trade it for is Common Lisp, not Python.

      And I know that on comp.lang.lisp there are some people who find Python a better Lisp, but I have done some small projects in Python, and I am now doing a large project in Common Lisp, and though I am still learning Common Lisp, I just like it better in every way.

      I cannot explain it completely, it is a combination of factors, starting with the fact that the things I do in Perl now, have been influenced by "How To Design Programs", the fact that Common Lisp always has a compiler, that through type assertions a Common Lisp program can be highly optimized by the compiler, that there are two nice Emacs environments for Lisp, SLIME and ILISP, that it is a relief from the line noise that is needed in Perl (but Python has also line noise : I hate the fact that dictionary keys have to be quoted (that is also why I do not like PHP)), that the lambda functions in Perl and Common Lisp are equally powerful, and not restricted as in Python.

    19. Re:Should I read this or continue with sed/awk? by doom · · Score: 1

      notwrong wrong:

      Well, I didn't mean that to be taken personally... but consider the fact that ESR is on your side.
      Egad, you're right! Is it too late to come back?

      No, no, never too late. Perl culture is pretty open, when you come down to it. No idea is too small to steal, and no programmer too weak to corrupt. Uh, I mean "train".

      (Don't worry, you can keep your perl use "minimal"... at first.)

    20. Re:Should I read this or continue with sed/awk? by Anonymous Coward · · Score: 0

      "I fear I'm starting a holy war by recommending Python in a Perl discussion. That's certainly not my intention. For those who already know and love Perl I say, great, keep on trucking. But I just can't see the point in steering newbies towards it."

      Apart from the healthy job market, the fact that actually *Python can't do everything Perl can*, and *Isn't* as mature and lacks anything close to CPAN.

      Sorry, sounds like a Troll for me.. I can't see any point in steering newbies towards Python, I say keep on using Python if you know and love it, but also STFU -- how many Perl Zealots do you see in every Python book review? None.

      From what I've seen of the Python community I think I'll stick with Perl, or leapfrog straight to Ruby, which fixes most of the problems in Python, but without the zealots or COBOL style indentation.

      Aaron Trevena (who hasn't used his slashdot login for so long he's forgotten it because there is so little worth reading or posting here any more)

    21. Re:Should I read this or continue with sed/awk? by Viol8 · · Score: 1

      >Apart from the healthy job market, the fact that actually *Python can't do everything Perl can*,

      Such as?

      >Aaron Trevena (who hasn't used his slashdot login for so long he's forgotten it because there is so little worth reading or posting here any more)

      Not eating your own dogfood? You certainly haven't contributed anything worthwhile with that post.

    22. Re:Should I read this or continue with sed/awk? by metamatic · · Score: 1

      I learned Perl back before Ruby was usable.

      I wouldn't bother to learn Perl now.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    23. Re:Should I read this or continue with sed/awk? by metamatic · · Score: 1

      Unlike Java, Perl has support for a decent set of built in data structures, and the built in regular expression syntax is second to none.


      Are we talking about the same Perl here? The one that doesn't even have multidimensional arrays? The one where there aren't real objects, just hacks using references and hashes? The one that has no standard data structure for dates, ?

      Oh, and Java has had regex support for a couple of years now.

      I'm no Java enthusiast, but please...
      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    24. Re:Should I read this or continue with sed/awk? by Tet · · Score: 1
      I gave up sed and awk for perl because I grew tired of silly limitations: 2048 chars per line in sed

      Ancient traditional Unix sed, perhaps, but not in any modern sed. I've personally used GNU sed on files with line lengths in excess of 100 million characters. ssed also has no line length limits, and I believe HHsed doesn't either.

      --
      "The invisible and the non-existent look very much alike." -- Delos B. McKown
    25. Re:Should I read this or continue with sed/awk? by bill_mcgonigle · · Score: 1

      Would an experience scripter suggest that I switch to perl (for it seems it can perform similar text manipulation functions conveniently in a programming lanuage), or spend more time with sed/awk?

      Anecdotally, I've tutored a dozen or so shell scripters on the use of perl and none has turned back.

      That's not to say I never write shell scripts, but once they get beyond a dozen or so lines or unless startup time is paramount (and perl startup is quite fast on modern hardware, so this is the hard-core case) I jump over to perl.

      Borrow a copy of Learning Perl from someone and read through the first chapter ('a brief stroll through perl', I think it's called). It'll probably take you half an hour, and my guess is you'll be hooked.

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
  12. gnucronyms by Anonymous Coward · · Score: 0

    gnucronyms are better:

    Perl = Perl Extraction and Report Language

    PHP = PHP Hyped Protocol

    ```
    http://www.planetamd64.com/index.php?s=&showtopic= 30239&view=findpost&p=288814

  13. That's cheating by Daishiman · · Score: 1

    It's not considered one line if it has 3398EAFF23 characters.

  14. Perl Script for the Dummy Like Me by andy314159pi · · Score: 1

    #!/usr/bin/perl -w ##Oh boy I'm using an advanced scripting language! system("/usr/local/bin/csh csh.script_1"); system("/bin/rm /home/me/file_to_be_removed"); system("/usr/local/bin/application & application_output "); system("/usr/local/bin/csh csh.script_2"); # system("/bin/cat "I know Perl" > resume.txt"); exit

    1. Re:Perl Script for the Dummy Like Me by Phillup · · Score: 2, Funny

      You don't eat or drink or mow the lawn;
      You just type on Slashdot all day long. And then one day... you learn how to format and preview.
      --

      --Phillip

      Can you say BIRTH TAX
    2. Re:Perl Script for the Dummy Like Me by andy314159pi · · Score: 1

      yeah I was excited about my "comedy."

    3. Re:Perl Script for the Dummy Like Me by andy314159pi · · Score: 1

      If I was really serious about Perl scripting I would have used "Paula" as a variable.

    4. Re:Perl Script for the Dummy Like Me by Anonymous Coward · · Score: 0

      #!/usr/bin/perl -w
      ##Oh boy I'm using an advanced scripting language!
      my @bar=("csh.script_1" "rm /home/me/file_to_be_removed application & application_output" "csh.script_2" "echo \"I Know Perl\" >> resume.txt");

      foreach my $foo (@bar) {
              system($foo);
      }
      exit;

  15. Basic way to clean up your Perl code by TheRealMindChild · · Score: 1, Funny

    10 CurrentFile = Dir("*.pl") 20 Do while len(CurrentFile) > 0 30 Kill CurrentFile 40 CurrentFile = Dir() 50 Loop 60 End

    --

    "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
  16. Re:Cryptic? Complex!? by MindStalker · · Score: 0

    Uhhh, yea you can purposefully make syntax cryptic in ANY language. Get back to me when you have a point.

  17. Re:Cryptic? Complex!? by Anonymous Coward · · Score: 0

    Whoosh!

  18. Re:Cryptic? Complex!? by clayne · · Score: 0, Flamebait

    Really. Does C have $_ or any number of ridiculously implied $ nonsense in it?

    Perl should have just stopped about 8 years ago.

  19. Perl Scripting for the Dummy Like Me (fixed) by andy314159pi · · Score: 2, Funny

    #!/usr/bin/perl -w
    ##Oh boy I'm using an advanced scripting language!
    system("/usr/local/bin/csh csh.script_1");
    system("/bin/rm /home/me/file_to_be_removed");
    system("/usr/local/bin/application & application_output ");
    system("/usr/local/bin/csh csh.script_2");
    #
    system("/bin/cat "I know Perl" > resume.txt");
    exit

    1. Re:Perl Scripting for the Dummy Like Me (fixed) by Anonymous Coward · · Score: 0

      Sadly for you, my friend, even THAT won't work.

      Escape quote marks FTW!

      That is all. :)

  20. Footer Quote - Huh? by Anonymous Coward · · Score: 0

    You'd think Slashdot could get the quote right:
    "All that is gold does not glitter, not all those who wander are lost."

  21. Why not for Windows people? by rrohbeck · · Score: 4, Interesting

    I think Windows folks need "Minimal Perl" a lot more.

    Just remembering by boss's jaw drop when he asked me if I could do a quick analysis of a couple thousand lines of logs and asked how long it would take. "10 minutes." And I delivered. He thought I'd have to fire up VS and write some C code.

    He borrowed my Camel book during his next vacation.

    1. Re:Why not for Windows people? by SCHecklerX · · Score: 1

      Good point.

      All of the windows boxes where I used to work had activestate installed on them, and if I ever have a job where I am administering windows systems again, that will be my first addition if it is not already there.

    2. Re:Why not for Windows people? by Phroggy · · Score: 3, Informative

      Have you tried Learning Perl on Win32 Systems? Windows users wouldn't benefit from the Minimal Perl approach, because they don't have the background it builds on. This book starts at the beginning.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    3. Re:Why not for Windows people? by Shadow+Wrought · · Score: 1
      Just remembering by boss's jaw drop when he asked me if I could do a quick analysis of a couple thousand lines of logs and asked how long it would take. "10 minutes." And I delivered. He thought I'd have to fire up VS and write some C code.

      <BOFH>Next time tell him an hour, do it in 10 minutes, and have 50 minutes of rrohbeck time.</BOFH> ;-)

      --
      If brevity is the soul of wit, then how does one explain Twitter?
    4. Re:Why not for Windows people? by matt+me · · Score: 1

      Brothers, stand back.
      http://xkcd.com/c208.html

    5. Re:Why not for Windows people? by bean123456789 · · Score: 3, Interesting

      I think your example is exactly why perl is so useful. For small, specific tasks that you may or may not ever need to repeat. I think for programs that will need maintenance it is a terrible language. Really it is the swiss army knife of languages and I'm glad that I learned it, but I would never write an involved script anymore.

    6. Re:Why not for Windows people? by fabs64 · · Score: 1

      No mod-points so just a "hear hear" from me.
      I use perl for the exact same reason you do.
      Also, I'm alternating between windows and unix all the time, and interfacing with Oracle db's a lot, two things that perl does VERY well.
      But all I'm doing is pushing logs back and forward, parsing them, possibly generating reports on the RI of the db etc.
      Oh, and for writing your sql for you, perl is gold for that, ever had to refactor every key in a 100+m row schema? blerch.

    7. Re:Why not for Windows people? by straybullets · · Score: 1

      And also there is PAR.
      It works really great now, and i frequently deliver to clients pp exe files that do run-once treatements.
      It's much easier than vbs for file processing, will leave no footprint on the server, and is still very easy to maintain as the exe is nothing but a compressed archive with the source code easily accessible

      --
      With that aggravating beauty, Lulu Walls.
    8. Re:Why not for Windows people? by Skrynesaver · · Score: 1

      Agreed Perl is at it's most useful for quick one line fixes, however when writing something *slightly* larger it can be useful to write the comments first, then add the code. I've written a few fairly involved scripts for internal use and other people have been able to maintain them because code:comment You are not obliged to obfuscate and the speed gains rarely match the long-term inconvenience, I don't run Gentoo either ;)

      --
      "Linux is for noobs"-The new MS fud strategy
    9. Re:Why not for Windows people? by pclminion · · Score: 1

      Take a lesson from Scotty. You should have said "an hour," which would have probably blown him away just as much. Then when you deliver in 10 minutes he thinks you're God.

  22. Re:Cryptic? Complex!? by MoxFulder · · Score: 5, Interesting

    Run that. Nothing cryptic or complex at all.
    Indeed! I used to be a die-hard hard-core Perl hacker. When I discovered Perl in college around 2001, I thought it was the greatest thing since sliced bread. And Perl really was revolutionary: you could do almost everything you could do in C, but more concisely, since you could create complex data structures without manual memory management.

    I used Perl for fun and profit (wrote many Perl scripts for a speech software company) for many years, hanging on past the point where others started using Python, PHP, and Ruby instead. I knew Perl and could practically think in it. But one of the main problems with Perl is it's so easy to right totally unmaintainable, totally unreadable code. I read a Perl program I wrote a few years ago and I can never figure it out. The object-oriented part of Perl is a ridiculous kludge with so many little details that I can't remember them all. There are about 100 subtly different ways to write a constructor for your object:

    sub new() {
        my ($class) = @_;
        my $self = {}
        return bless $self, $class
    }

    sub new() { return bless {} }

    sub new() {
        my ($class) = @_
        my $self = {}
        bless $self, (ref $class || $class)
    }

    All of these, of course, have subtly different behaviors. The second will break inheritance. The third will allow you to use the constructor as an instance method, not just a class method. There are no enforced function prototypes or standard way to get parameters... and if you do use the *optional* prototype mechanism, you will subtly change the precedence of calls to your function.

    I thought that having 1000 ways to do something was great, but it turns out to be a nightmare for non-trivial programs. Every time I try to use a cute fancy shortcut in Perl, it bites me in the ass. As a result of the over-flexibility, people have tried to impose "standards" on Perl. There are "standard" techniques for named parameters, "standard" techniques for accessor functions, etc. And that's nice, but Perl has 10,000+ available modules to do everything from screen-scrape Google news to access Oracle databases (it's greatest strength!!!). And not all those modules use the standard techniques.

    About a year ago I decided to give Python a try. And I haven't looked back. It can do everything Perl can do, and then some. Everything is clearer and having a "standard" way to do most things makes learning new modules immensely easier. Having slightly more verbose syntax and strict type-checking is slightly annoying at first, but keeps me sane in the long run.

    Basically I don't use perl for anything other than one-liner regexp tricks anymore. Stuff like perl -i -pe 's/FOO/BAR/g' *, which will change the string FOO to BAR in all the files in the current directory.
  23. Very Minimal Perl for Unix People by Phreakiture · · Score: 2, Informative

    Very useful if you need to use text files from DOS/Windows and DOX2UNIX is not installed:

    perl -e "while(<>){s/\r//;print;}"

    This strips carriage returns out of a file, and does it pretty quickly.

    --
    www.wavefront-av.com
    1. Re:Very Minimal Perl for Unix People by torstenvl · · Score: 1

      mv text.txt text.dos && cat text.dos | tr -d "\r" > text.txt && rm text.dos

    2. Re:Very Minimal Perl for Unix People by Tet · · Score: 4, Informative
      This strips carriage returns out of a file, and does it pretty quickly.

      No, it's horrendously slow. The traditional Unix way of doing it (tr -d '\015') is around twice as fast on files that are sufficiently large that startup costs are lost in the noise, and even faster on smaller files.

      --
      "The invisible and the non-existent look very much alike." -- Delos B. McKown
    3. Re:Very Minimal Perl for Unix People by imadoofus · · Score: 1

      Shouldn't that be

      perl -en "s/\r//;print;"

      --
      "pr0n": An anagram of "porn," possibly indicating the use of pornography. - www.microsoft.com
    4. Re:Very Minimal Perl for Unix People by ramunasg · · Score: 1
      Perl has very useful -p option which read line to $_ and prints $_. So this becomes shorter:

      perl -pe 's/\r//'
    5. Re:Very Minimal Perl for Unix People by jcuervo · · Score: 2, Informative

      Shouldn't that be perl -pe 's/\r$//;'

      --
      Assume I was drunk when I posted this.
    6. Re:Very Minimal Perl for Unix People by imadoofus · · Score: 1

      It's like I expect from Perl...there's always a shortcut. Oh well. Something new learned today.

      --
      "pr0n": An anagram of "porn," possibly indicating the use of pornography. - www.microsoft.com
    7. Re:Very Minimal Perl for Unix People by I+Like+Pudding · · Score: 1
      The shortest correct* version, cross-platform:

      perl -pe"s/\r//"
      * Bulletproofed: s/\013\010/\010/g
    8. Re:Very Minimal Perl for Unix People by FuzzyFox · · Score: 1
      How about:

      perl -p -e 's/\r//' <files...>

      You don't have to code the while(<>) and print statements; -p will do that for you.

      --
      splunge (n) -- A good idea.. but it could be lousy... and I'm not being indecisive!
    9. Re:Very Minimal Perl for Unix People by wealthychef · · Score: 1

      The classic rebuttal to your rebuttal is that you had to load 4 programs to do your work, so if you were doing this to hundreds of files, perl would kick your ass badly. Especially because perl could do the hundreds of files in ONE invocation. Nice try, though. :-)

      --
      Currently hooked on AMP
    10. Re:Very Minimal Perl for Unix People by Anonymous Coward · · Score: 0

      Bullshit. Not to mention the same can be done much cleaner than the original poster:

      tr -d'\r' $file.new;mv $file.new $file

      I'd wager good money that overhead of the above is lower than loading the entire Perl binary. Even for hundreds of files.

      Perl abuse is a pain in the backside. All you Perl weenies need to learn the basic toolkit first, and stop busting out Perl when it isn't needed.

    11. Re:Very Minimal Perl for Unix People by darkwhite · · Score: 1

      Looks like tr block-buffers the stream, perl line-buffers it. Turn off line buffering and it's nearly identical:

      >time cat U00096.gb|perl -e'undef $/;while(){s/\r$//go;print}'>/dev/null

      real 0m0.064s
      user 0m0.011s
      sys 0m0.022s
      >time cat U00096.gb|tr -d '\015'>/dev/null

      real 0m0.057s
      user 0m0.014s
      sys 0m0.007s
      >time cat U00096.gb|perl -ne's/\r$//go;print'>/dev/null

      real 0m0.175s
      user 0m0.126s
      sys 0m0.009s

      Perl is usually dramatically faster than sed and awk. Most importantly, it's usually a lot easier to write.

      That said, they really need to hurry up on Perl 6, otherwise they'll bleed most of their userbase to python and ruby.

      --

      [an error occurred while processing this directive]
    12. Re:Very Minimal Perl for Unix People by Tet · · Score: 1
      Perl is usually dramatically faster than sed and awk.

      No, perl is almost invariably slower than sed (although it is faster than awk). It's more flexible, though, and easier to write for non-trivial mangling of text.

      --
      "The invisible and the non-existent look very much alike." -- Delos B. McKown
  24. Re:Perl smells funny by halivar · · Score: 1

    Them's fightin' words! If I PEEK and POKE enough, I could probably hack your box and fry your monitor!

    And I'll do it without line numbers! Fear me!

  25. Cryptic? by locokamil · · Score: 3, Insightful

    Perl newbie here.

    Is it just me, or is it possible to create perfectly legible code in Perl if you use good technique, just like in any other language?

    The cryptic/convoluted stuff only comes out when you try to be too cute. ..

    1. Re:Cryptic? by drinkypoo · · Score: 3, Informative

      Is it just me, or is it possible to create perfectly legible code in Perl if you use good technique, just like in any other language?

      Of course. The thing that people complain about is that perl allows you to write code that only a fellow perl-head can understand. It's harder to accomplish that with C, for example. But perl doesn't automatically mean you won't understand it. It just makes it more likely :)

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    2. Re:Cryptic? by abigor · · Score: 1

      Sadly, depending on people to behave well doesn't work, particularly in large projects. That's just life, I guess. Languages that enforce legibility (Python is great for that) lead to lower maintenance costs in the long run. And it's all about the bottom line.

    3. Re:Cryptic? by Prof.Phreak · · Score: 2, Insightful

      Cryptic perl is a myth. It's only cryptic if you don't understand it (or if things aren't indented properly).

      Whenever I come across code that just looks like `an explosion at an ascii factory', I first indent it (which usually fixes the readability). If that doesn't work, I try to figure out what it's trying to do (likely developer didn't know any better, and used some clunky code to do something trivial; usually code that can easily be `clarified' by replacing whole sections of it with a single regex).

      Perl is surprisingly beautiful and easy to read language---you just have to know it well.

      --

      "If anything can go wrong, it will." - Murphy

    4. Re:Cryptic? by qwijibo · · Score: 1

      I think the majority of problems people have with Perl is when they want to learn Perl but have no interest in regular expressions. A 30 line program with a few non-trivial regular expressions looks deceptively simple, but is performing the job of a program that would be several thousand lines of code without the regular expressions.

      Based on my own experience, I think management frequently drives the impression that perl code is unmanageable. I have had several occurrences where proof of concept code (like used in the "so is this the kind of thing you're trying to do?" requirement development phase) is rolled out straight into production with known bugs, no documentation, and since the project is "done", there will never be any effort put into cleaning up the code, documenting anything, or letting anyone know what does and doesn't work. I'd like to work in an environment where projects are taken more than 10% towards completion and management delegates technical decisions to competant, technical people. However, in the really real world, things don't always work that way. And when some new manager saves several thousand dollars by firing the expensive programmer and replacing him with a college student who wrote "programer" on a resume, the student and everyone else gets the impression that the code is unmanageable because it was never left in a state where it was intended to be maintained. Of course, no one will point out the root cause of bad management, so blaming Perl sounds good, since everyone "knows" that perl code is cryptic and convoluted. =)

    5. Re:Cryptic? by zero1101 · · Score: 1

      Perl newbie here. Is it just me, or is it possible to create perfectly legible code in Perl if you use good technique, just like in any other language? The cryptic/convoluted stuff only comes out when you try to be too cute. .. You're basically right. The problem is that when you've been writing Perl for a while, the shortcuts and such start to come naturally. It's not that the programmer is trying to be cute, but that the weird, unnatural-looking Perl constructs actually flow more logically once you're used to them. So while it's easier for a non-Perl programmer to read:

      foreach $foo (@bar) {
      if($foo) {
      print $foo;
      }
      }
      writing something like that would be painful for a Perl programmer. (Sorry, can't seem to get my indents to happen in the code block above.)
    6. Re:Cryptic? by locokamil · · Score: 1

      Actually, that one threw me the first time I saw it... although I find that if you throw in a "use strict" in your code, it forces you to scope your variables properly, and thus drives home what the code is attempting to do more clearly.

    7. Re:Cryptic? by stefanlasiewski · · Score: 3, Funny

      Cryptic perl is a myth. It's only cryptic if you don't understand it.

      Cryptic 32-character hexadecimal MD5 hashes are a myth. It's only cryptic if you don't understand it.

      --
      "Can of worms? The can is open... the worms are everywhere."
    8. Re:Cryptic? by chromatic · · Score: 1

      Languages that enforce legibility (Python is great for that) lead to lower maintenance costs in the long run.

      Oh, does pychecker run by default on all Python programs now? Does it enforce variable declarations and warn on potential shadowings? Does it force the use of good identifier names?

      No?

      Hm. Pity. Those are much bigger parts of maintainable coding than the lack of sigils or enforced horizontal whitespace.

    9. Re:Cryptic? by rrohbeck · · Score: 1

      Depends. Since laziness is one of the main virtues, once you're good at it you'll write line noise regular expressions and lots of map {...} grep {...} sort map {...} @ThisOrThat, something that most folks without Lisp or Perl background have trouble with at first. Or $hr->{this}->[$that]->{$SomethingElse}. It just comes natural.

      The basic question is always, is this a one-shot quickie or something that'll have to be maintained. Unfortunately, it often turns from the former into the latter.

      If you start out writing legible code, it can be easily done, but it is slower than hacking mode. If not, you'll have trouble understanding your own code a month later.

    10. Re:Cryptic? by zero1101 · · Score: 1

      The only thing that changes if you use strict in this example is throwing a "my" in front of $foo. Not sure how that improves syntactic clarity.

    11. Re:Cryptic? by daveclearyinmd · · Score: 1

      Perl is just one of the languages that I use in my job. 10 years ago I wrote several large Perl/CGI database systems that I would be scared to try to maintain now; but at the time, I was able to develop and maintain hundreds of CGI's.

      These days, 90% of my perl scripts are less than a screenful, for either one-time use, or embedded in some batch/shell script. I have hundreds of .pl files in my tools directory, and its pretty easy to make them and keep them readable, if you want to.

      If you were developing a large system, or developing in a large team, or developing something that might live forever, then maybe Perl isn't the right tool for the job. YMMV.

    12. Re:Cryptic? by swordgeek · · Score: 1

      It's entirely possible. However, a lot of the cryptic bits are carefully invented shortcuts to shorten code, either syntactically or logically. "Programming Algorithms in Perl" has some good examples of this.

      Basically, Perl offers the opportunity to write more condensed code than most other languages.

      --

      "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
    13. Re:Cryptic? by element-o.p. · · Score: 1

      Is it just me, or is it possible to create perfectly legible code in Perl if you use good technique, just like in any other language?

      A little from column "A", a little from column "B"....

      Perl is kind of a strange language, in that it's a mish-mash of awk, sed, C, bash, and Larry Wall only knows what else. As a result, there are a number of ways of doing the same task in Perl. While this can be a good thing, it's also the biggest problem I have with Perl--the Perl code I write may not look anything like the Perl code someone else writes, and therefore it can be really hard to follow the logic in someone else's code.

      The second biggest problem I have with Perl is all of the special symbols, and remembering when to use them. I can't count how many times I've used "@variable[$index]" instead of "$variable[$index]" and I always have to "man perlvar" to find out which special characters need to precede ARGV to pull parameters from the command line.

      While good programming techniques can help make Perl more readable, it's definitely not the prettiest language. But, it's definitely a good, useful language. For now, it's my language of choice :)
      --
      MCSE? No, sir...I don't do Windows. Yes, I am an idealist. What's your point?
    14. Re:Cryptic? by Just+Some+Guy · · Score: 0, Troll

      Is it just me, or is it possible to create perfectly legible code in Perl if you use good technique, just like in any other language?

      No. It's handling of complex data structures is syntactically nightmarish. In Python, a list of dicts (Perl would call them hashes) looks exactly like a list of hashes:

      examplelist = [1, 2, 3]
      exampledict = {'foo': 42, 'bar': 17}
      examplenested1 = [{'foo': 42, 'bar': 17}, {'baz': 23, 'quz': 5}]
      examplenested2 = {'foo': [1, 2, 3], 'bar': [4, 5, 6]}

      Voila. That's it. You now know how to write any list, a nested list, a dict, a dict of lists, or any other combination you can think of. Furthermore, you can pass any of those as an argument to a function, or return any of them from a function - with no extra syntax whatsoever:

      def foo(bar): print bar; return [[4, 5], [6, 7]]

      print foo({'foo': [1, 2, 3]})

      # Result:
      # {'foo': [1, 2, 3]}
      # [[4, 5], [6, 7]]

      Now, for the exact opposite, read the perldoc page for "perlref" and see how Perl likes you to pass around data structures. Hint: you have to cast everything to the "scalar" datatype before you can pass it in or out of a function.

      These million-and-one special cases are why I abandoned Perl for Python. Yes, it's theoretically possible to write clean Perl code, but the language has so many artificial barriers to doing so that it's practically impossible. The best you can reasonably hope for is that your group, project, or employer chooses a set of coding standards that tells you how to handle every non-standard gotcha that arises so that you'll recognize them when (not if) you see them.

      --
      Dewey, what part of this looks like authorities should be involved?
    15. Re:Cryptic? by chromatic · · Score: 1

      Hint: you have to cast everything to the "scalar" datatype before you can pass it in or out of a function.

      Perl's dereferencing syntax can be grotty, but that's no reason for you to spread misinformation. If you're going to criticize it, stick to things that are actually true. (I recommend something like "Perl 5's requirement for taking explicit references to aggregates confuses/frustrates me.")

    16. Re:Cryptic? by Just+Some+Guy · · Score: 1

      Perl 5's requirement for taking explicit references to aggregates confuses/frustrates me.

      You meant "references stored in scalars", just as I said. I'd agree with the rest of your statement, too: I'm confused by the idea of a modern high-level language being dependent on explicit reference manipulation for common tasks, and frustrated that I have to do that in Perl but not in Python or Ruby (or Java, for that matter).

      I don't hate Perl and I'm competent with it, but if I wanted to deal with that level of bookkeeping, I'd probably just write C and be done with it.

      --
      Dewey, what part of this looks like authorities should be involved?
    17. Re:Cryptic? by runningduck · · Score: 1

      I agree. Not only is it harder to create unreadable code with C, in C the purpose of the code is often obvious even to non-programmers.

      http://www.ioccc.org/1995/dodsond1.c
      http://www.ioccc.org/1994/dodsond1.c
      http://www.ioccc.org/1994/schnitzi.c
      http://www.ioccc.org/1994/shapiro.c

      Although I guess the this last one is an exception.
      http://www.ioccc.org/1988/phillipps.c

      --
      -rd
    18. Re:Cryptic? by dcam · · Score: 1

      Actually it is worse than that. perl allows you to write code that only a fellow perl-head who uses the same subset of syntax.

      --
      meh
    19. Re:Cryptic? by publius_ovidius · · Score: 1

      I don't hate Perl and I'm competent with it, but if I wanted to deal with that level of bookkeeping, I'd probably just write C and be done with it.

      Whoa there, dude. Hinting at a comparison of Perl's references to C's pointers is like comparing untying your shoelace to untying the Gordian knot. In fact, comparing something so simple (with a sometimes annoying syntax) with something so confusing that many programmers never master it is so ridiculous that I know that couldn't possibly be what you meant. So what did you mean?

    20. Re:Cryptic? by bill_mcgonigle · · Score: 1

      Is it just me, or is it possible to create perfectly legible code in Perl if you use good technique, just like in any other language? The cryptic/convoluted stuff only comes out when you try to be too cute. ..

      Absolutely. But don't let your sense of reasoning insulate you from the scare mongers promoting other languages that are slow, unpopular, or have tiny community libraries!

      My perl tends to look much like my java which looks much like my C++. I tend to use foreach's instead of maps when it's more clear, and generally make things easier for me to read at a later time, because I'm going to have to, and I might need to translate them into another language for a different project.

      That said, perl can be incredibly powerful and in some cases you need to understand the language to read it (shocking, no?). For instance I might have a list of people containing a record (as an associative array a.k.a. hash) for each person, e.g. %person with $person{last_name}, $person{first_name}, $person{age} and I want to sort a the list (@people) by age. In perl it might look like:

      my @sorted_people = sort { $a{age} $b{age} } @people;

      To understand this you need to know two things: the sort operator takes an optional function, which defines $a and $b as the two objects to compare and that perl has a special operator (the SpaceShip operator) which is a trinary result operator that meshes really nicely with sort.

      But once you learn that simple idiom, doing complicated sorting tasks is really really easy. The Java approach would never let you do something like that and you'd develop a class, using iterators, vectors, collections, and it might be more readable to somebody with no knowledge of perl, but it would also be 30 lines long. That also increases the potential bug count.

      I write java too, but try to pick the best tool for the right job.

      Perl does have a major weakness - dealing with complex nested data structures and references is hard and ugly. At a certain depth it becomes painful, especially if the structure isn't known a-priori. I hope this is better in Perl 6.

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    21. Re:Cryptic? by oblivion95 · · Score: 1

      Things that make perl cryptic:

      * "use Foo;" can cause symbols to enter your package. The reader of your code may wonder where the symbols came from. He will have to examine every loaded module to find them.

      * A different module can add symbols directly into your module's package before you module's code even begins to execute.

      * Code does not execute in order; the reader must find all BEGIN blocks.

      * There is a difference between an ARRAY and an ARRAY reference.

      * It is impossible to alias a package.

      I could go on and on. In a nutshell, Perl literally encourages unmaintainable code.

  26. Re:Cryptic? Complex!? by jellomizer · · Score: 0, Flamebait

    Perl being a simple programming langues causes Bad Programmers to make overly Criptic code. Unlike say Python which forces some good coding practices. Perl and other Languages gets Cryptic when Regular Expressions are used. I myself tend to avoid Regular Expressions when possible. I know they are powerful, fast and usful and such, but they make my code ugly and anyone who doesn't know them thinks I am writting in binary. In my line of work being able to change code quickly (Because of rapidly changing requirements) is far more important inital coding time, or even processing speed.

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
  27. That's fine by RiotXIX · · Score: 1

    No that's brilliant - thanks for your opinion. A lot of people are pushing me for python, but I always figured it's reveared status for text processing/manipulation & wealth of existing scripts/implementations would mean perl would win hands down.

    But if it's possible to do these things with python, then I'll go for that (soley for the reason that certain people with opinions I respect say it's the new way forward). I don't want to waste my time focusing on two languages (learning perl, and then moving to python later). Text processing in python is precisely the kind of reference I need.

    --
    "You know you don't act like a scientist, you're more like a game show host." Dana Barret
    1. Re:That's fine by MoxFulder · · Score: 1

      No that's brilliant - thanks for your opinion. A lot of people are pushing me for python, but I always figured it's reveared status for text processing/manipulation & wealth of existing scripts/implementations would mean perl would win hands down.


      I had the same misconception! Turns out it's not much harder to do regexp stuff in python than in Perl:

      PERL
      ----
      $foo =~ s/bar/baz/;

      if ($foo =~ /bar(...)) { print $1 }

      PYTHON
      ------
      from re import *

      replace(foo, 'bar', 'baz')

      match = search(foo, 'bar(...)')
      if match: print match.group(1)

      So... there's a little bit of extra boilerplate in Python, but that's it! For one-liners, Perl still wins, but for anything longer I think you'll appreciate the extra clarity of Python.

      The best part is, the Python regexp syntax is an exact duplicate of the Perl syntax. The Python people made the decision to use the exact same syntax for the regular expressions as in Perl. A very smart decision I think. All my knowledge about \s and [A-Za-z] and (?:foo) transferred directly over with Python. Awesome!
    2. Re:That's fine by eneville · · Score: 1

      No that's brilliant - thanks for your opinion. A lot of people are pushing me for python, but I always figured it's reveared status for text processing/manipulation & wealth of existing scripts/implementations would mean perl would win hands down.


      I had the same misconception! Turns out it's not much harder to do regexp stuff in python than in Perl:

      PERL
      ----
      $foo =~ s/bar/baz/;

      if ($foo =~ /bar(...)) { print $1 }

      PYTHON
      ------
      from re import *

      replace(foo, 'bar', 'baz')

      match = search(foo, 'bar(...)')
      if match: print match.group(1)

      So... there's a little bit of extra boilerplate in Python, but that's it! For one-liners, Perl still wins, but for anything longer I think you'll appreciate the extra clarity of Python.

      The best part is, the Python regexp syntax is an exact duplicate of the Perl syntax. The Python people made the decision to use the exact same syntax for the regular expressions as in Perl. A very smart decision I think. All my knowledge about \s and [A-Za-z] and (?:foo) transferred directly over with Python. Awesome! sometimes reading through all the extra lines just makes things harder to understand. sometimes i prefer to just read a short snippet to get the gist.
    3. Re:That's fine by tek.net-ium · · Score: 1
      Your license as a Python hacker is hereby revoked.

      from re import *
      So, you put the match function in the global namespace.

      match = search(foo, 'bar(...)')
      And now you overrode it. Never import modules like this.
    4. Re:That's fine by MoxFulder · · Score: 1

      Yes, I'm aware of that :-P I was trying to give a very short example, and the objects returned by re.search are called "match objects". I wouldn't do that in a real program. *sheesh*

  28. Not hard to learn, very easy to remember by SCHecklerX · · Score: 4, Insightful

    The only 'strange' thing with Perl is its use of symbols to denote things. That is not really that big of a deal, and in fact makes working with code a bit easier, IMO, since you know loosely what type a variable is just by looking at it and the context of the code that surrounds it.

    The thing I've noticed, as a Perl programmer, is that it is the *only* language I've ever used (amongst bash, c, c++, java, rexx, fortran, basic) that I can take a break from for a year, come back, and be able to write a simple script without the need to refer to any books or online manuals. That is VERY useful for those of us who are more sysadmins than programmers. This power is partly due to the "more than one way to do it" philosophy, that lets you program in a style that works for you, hence allowing you to remember *how* to write in that language.

    Then again, that's what most anti-Perl folks bitch about. Any language can be obfuscated. If you write hard to decipher code in Perl, you'll write it that way in any language.

    1. Re:Not hard to learn, very easy to remember by quintesse · · Score: 1

      "without the need to refer to any books or online manuals That might be true for you, maybe you've got some kind of photographic memory but for me it's 100x times easier to come back to a language that just says Map things instead of trying to remember what kind of variable %things is exactly. (NB: Had to google for the % symbol, thought it was @ for maps actually, see?)
    2. Re:Not hard to learn, very easy to remember by tfried · · Score: 1

      Yes, Perl is wonderfully easy to write - and devilishly hard to read. Which makes it great for the quick write-once 30 line hack. For anything else: scripts that need more than two hours of total development time, scripts that some stranger (like yourself in a few years) will have to maintain, scripts that will need to be modified at some later point of time, scripts that might ever evolve beyond their original limited purpose, ..., - you better switch to some other language before it's too late.

      "More than one way to do it" is a large part of the problem. If the language permits you to do something in 26 different ways, you'll use 4 in the first version of your script, 7 in the second, 11 in the third, and you'd better be prepared to understand all the 25 different ways to do it all do the same thing, when debugging the 13th version of your script a year later.

    3. Re:Not hard to learn, very easy to remember by goombah99 · · Score: 1

      I have noticed the same. it's the one language that sticks with me despite breaks. And anything I forget is in the man pages in plain english not to auto-matically generated document.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    4. Re:Not hard to learn, very easy to remember by chromatic · · Score: 1

      If the language permits you to do something in 26 different ways, you'll use 4 in the first version of your script, 7 in the second, 11 in the third, and you'd better be prepared to understand all the 25 different ways to do it all do the same thing, when debugging the 13th version of your script a year later.

      May I respectfully suggest that you avoid the breakfast cereal aisle of American supermarkets? I fear you might either starve or eat yourself to death with all those choices.

    5. Re:Not hard to learn, very easy to remember by tfried · · Score: 2, Insightful

      Thanks for your concern. I'm still fairly successful at keeping my weight.

      When it comes to programming, however, I have discovered, my worst enemy is always that guy pretending to be me from around two years past. Admittedly, he does some pretty clever things sometimes, but invariably in totally strange ways. He's been following me around since quite a long time, by now, but I've never quite figured out his ways. I found, giving him a least some constraints on how he can believably impersonate my past self is often rather helpful.

    6. Re:Not hard to learn, very easy to remember by chromatic · · Score: 1

      Of course. It's self-discipline that's important. I don't know how any language can enforce that, though.

  29. Not always cryptic by ErGalvao · · Score: 1

    [...] it has a reputation for taking an excessive cryptic nature [...]
    Actually this is a common mistake associated with Perl. The language can be as readable as PHP (believe me, Perl was my first language and I work with PHP since 2002), but it can become cryptic as well. It all depends on the coding style of the author.

    Writing a Perl script is fairly easy. Modifying another programmer's Perl script can be tough.
    --
    Er Galvão Abbott - IT Consultant and Developer
  30. Re:Arguably one of the greatest? by Goaway · · Score: 1

    Nice list of languages nobody uses there.

  31. Re:Cryptic? Complex!? by Millenniumman · · Score: 2, Interesting

    How do you avoid using regular expressions? What do you replace them with? And how can they be confused with binary?

    --
    Stupidity is like nuclear power, it can be used for good or evil. And you don't want to get any on you.
  32. Re:oh come on, you're not even trying now by SCHecklerX · · Score: 1

    Perl's "TMTWWTDI" actually DOES keep it simple. It allows you to adapt a specific style, and consistently use it.

    Perl is the only language I have used that I can walk away from for a year, and then use it again WITHOUT having to touch a book or online manual.

    What, exactly, does Perl's use of non-text characters have to do with consistency? BTW, ever try to write C code without (){}+=-*? Thought so.

  33. Re:oh come on, you're not even trying now by Fahrenheit+450 · · Score: 1

    I'd guess that it is one of the greatest languages in the same sense that McDonald's is one of the greatest restaurants.

    --
    -30-
  34. Re:Cryptic? Complex!? by Ikoma+Andy · · Score: 3, Funny

    But one of the main problems with Perl is it's so easy to right totally unmaintainable... Dude, I'm thinking it's not Perl that was your problem...
  35. Rexx by LeninZhiv · · Score: 1

    Perl was long my scripting language of choice until I discovered Rexx, which to me has a very similar feel and philosophy, but is much easier to retain the whole syntax of, and (the big winner) *much* easier to reread a month later.

    Of course, Rexx is not an *it* language, but even Perl seems to be waning in favour of Python and Ruby, so I'll take the risk in bringing it up even if it isn't something we're 'supposed to be' excited about. As if a robust and mature scripting language were a bad thing...

    1. Re:Rexx by LMacG · · Score: 1

      Just out of curiousity, what environment are you using Rexx in? I wrote some pretty bitchin' REXX scripts on OS/2 back in the day.

      --
      Slightly disreputable, albeit gregarious
    2. Re:Rexx by LeninZhiv · · Score: 1

      Regina on Linux is my current weapon of choice. (Perl and Unix really do fit hand-in-glove in some ways, but Rexx is so easy to use and so easy to remember that I think it adapts really well to the Unix/Linux world*, even if it isn't 'native' to the platform's culture.) Not to diss hard-core Perl hackers, but for people who only occasionally have recource to a scripting language yet don't want to sacrifice power I think Rexx is a real win.

      * So long as you are open-minded enough that you can get used to some syntactic idosyncracies like && meaning XOR and \ meaning !

  36. Re:Cryptic? Complex!? by MoxFulder · · Score: 1

    Hehehe... ya got me! You know what's funny? I think that's the first time I've ever made that mistake. I'm a bit of a grammar Nazi normally. I'm off to do some self-flagellation now.

  37. Here here! by Anonymous Coward · · Score: 0

    I'll second that. Given how *ugh* painful scripting anything is in DOS, Perl is almost a necessity.

    And I say this as someone who has written both nasty recursive DOS batch files because DOS makes it hard to do simple things like loops and subroutines cleanly, as well as someone who has written crazy multi-threaded network scripts in Perl (single threaded is way too slow, although fork() and shared memory under Windows can be kinda buggy).

  38. Re:Cryptic? Complex!? by Ikoma+Andy · · Score: 1

    Cool. I'm going to go try python.

  39. I've got a question about subtypes of acronym by spun · · Score: 3, Funny

    Remeber that a "Backronym" (hate that word!) is a subtype of acronym.

    Would Muhammad Ali's GOAT (Greatest Of All Time) line of food products be considered a snackronym or a blackronym?

    --
    - None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
  40. Picking Up Perl by nbritton · · Score: 4, Informative

    This: http://www.ebb.org/PickingUpPerl/pickingUpPerl.pdf guide is awesome if you want to learn Perl. Concise and articulate, it manages to explain all the major topics of Perl in 66 pages. I recommend working through the entire guide as quick as possible, don't worry about remembering everything as you can always come back to it later. I also recommend having the O'Reilly camel books (Learning Perl, Programming Perl, Perl Cookbook) handy when going through the guide. You can read the books here: http://www.jimsannex.com/Studies/CD_perl/index.htm but you better go out and buy the real thing, worth every penny!!! If your running Windows you'll need to download Perl and a good editor with syntax highlighting:

    http://downloads.activestate.com/ActivePerl/Window s/5.8/ActivePerl-5.8.8.820-MSWin32-x86-274739.msi
    http://www.crimsoneditor.com/

    After you install perl open a command prompt and run ppm, this is your simple GUI gateway to CPAN packages (make a mental note). After you get a handle on basic perl checkout Perl/Tk (GUI Toolkit for Perl). The Tk packages are included and installed with ActivePerl... Here's your first Perl/TK program:

    use Tk;
    my $top = new MainWindow;
    $top->configure(-title=>"My First Perl GUI Program");
    my $lab = $top->Label(-textvariable=>\$labelText);
    my $b = $top->Button(-text=>'Click Me!', -command=>sub {$labelText="Congratulations! it worked!" });
    $lab->grid(-row=>0, -column=>0);
    $b->grid(-row=>1, -column=>0);
    MainLoop;

    1. Re:Picking Up Perl by Eivind+Eklund · · Score: 1
      What should those of us that want people to NOT pick up Perl do?

      I first started programming in Perl since 1996. I know what the difference between $main::{fool} = $geek and *fool = $geek is. And I think it is time we let Perl die, letting the new and better generation (Ruby, Python) take over.

      Eivind.

      --
      Doubting the existence of evolution is like doubting the existence of China: It just shows that you're uninformed.
    2. Re:Picking Up Perl by nbritton · · Score: 1

      "What should those of us that want people to NOT pick up Perl do?"

      You should do nothing, If someone wants to learn about it (it being whatever it is) then you should not interfere. If what you say about Ruby and Python are true then Perl will become less and less relevant. It's effectively a self correcting problem.

    3. Re:Picking Up Perl by Eivind+Eklund · · Score: 1
      Will it? This is not 100% clear, as you're including personal emotional investment by people. This investment in Perl is high, given the complexity of Perl. And you include the size of the Perl community doing advocacy, usually without properly knowing the alternatives.

      What I humourously tried to convey is that pushing people towards Perl may be a destructive act. What those of us that see it as a potentially destructive act should do, in my opinion, is (A) refrain from pushing people towards Perl ourselves, and (B) telling those that push people towards Perl that we see their behaviour as potentially destructive.

      What I'm hoping will happen, of course, is that you take the time to investigate the alternatives, learning why I and other people with a lot of Perl experience see advocating Perl as destructive.

      And posting things to make it easier to find ways to get to learn Perl is a way to make more people that don't know Perl go towards Perl - instead of maybe leaving them undecided and going for something else after having checked things out.

      So, effectively, you are interfering with people learning other things. This is against what you said above ;)

      Eivind.

      --
      Doubting the existence of evolution is like doubting the existence of China: It just shows that you're uninformed.
    4. Re:Picking Up Perl by nbritton · · Score: 1

      Not interfering. I'm facilitating, the choice to learn Perl was theirs. The biggest reason to learn Perl (over ruby or python) is because it's already installed on 90~99% of *Nix systems. Same thing for learning vi, awk, sed, csh, bash, etc. etc. A good admin should know at least the basics of these things even if they prefer not to use them. If it where Ruby or Python that came first and Perl was the hot new thing you'd still need to learn about the old stuff.

  41. It gets worse... by mkcmkc · · Score: 1
    Even this

    /$foo[bar]/
    has no comprehensible meaning.

    Perl could be the first language to bow out gracefully when it's day is done, but I'm not holding my breath...

    --
    "Not an actor, but he plays one on TV."
  42. Um... by Anonymous Coward · · Score: 0

    Its aim is to filter out the complex way of writing programs using Perl and whenever possible to accomplish tasks using just one or two lines of Perl.

    Isn't this line kind of contradictory? The "complex way of writing programs using Perl" is using "just one or two lines of Perl..."

  43. Re:Cryptic? Complex!? by massysett · · Score: 4, Informative

    Stuff like perl -i -pe 's/FOO/BAR/g' *, which will change the string FOO to BAR in all the files in the current directory.

    Sed will do that too:

    sed -i 's/FOO/BAR/g' *

    The review says that the book uses the reader's knowledge of sed, awk, and grep. I figure: why not just use sed, awk, and grep...however, one advantage for Perl here is that (I presume) that line works with any Perl; '-i' is a GNU sed extension and may not work on non-GNU seds...

  44. Re:Perl smells funny by Chysn · · Score: 1

    Far from dead, of course. If you mean "dead as a web development language," then sure, almost. But it was never so great at that anyway.

    I used to write web apps of moderate size in Perl. I don't any more, but I still use Perl almost every day as a part of my system administration duties. It's a great tool for little scripts that get data from a text file or a database, do something with it, and spit it back into a text file or database. As a language for extracting data and generating reports, it's quite practical.

    --
    --I'm so big, my sig has its own sig.
    -- See?
  45. Re:oh come on, you're not even trying now by fireboy1919 · · Score: 4, Interesting

    You're not looking at it right.

    KISS is hard. Very hard. It's different in different places. Sometimes keeping it simple means writing less code. Sometimes it means creating a new sub-language that better describes your problem.

    In perl, you can change the nature of the language itself. *Everything* can be changed. The idea is that if there is more than one way to do it, then you can do it the simplest way for whatever definition of simple is required.

    Maintaining consistency is up to the developer himself. Obviously, those tempted to succumb to the lure of sloppiness (which, unfortunately, in my experience, is every perl programmer I've ever met including myself) shouldn't use perl for really big projects.
    You can't blame the language for giving you that freedom, though.

    Perl is where it is because you don't have to change the way that you think in order to program in it. Perl will change how it works to match how you think, which makes it more convenient than almost any other language.

    That particular behavior is what makes it possible to have so many perl modules in existane, which in turn is responsible for the popularity. It's also why about half of those modules have bugs so horrible that they're unusable. It's certainly a tradeoff.

    --
    Mod me down and I will become more powerful than you can possibly imagine!
  46. Cryptic whitespace by myowntrueself · · Score: 3, Insightful

    Languages that enforce legibility (Python is great for that)

    A language which makes a semantic distinction between tabs and spaces may give the appearance of enforcing legibility but in fact does little useful to help legibility.

    A programming language should not make a distinction on meaning based on whether tabs or spaces are used; all whitespace should be regarded equaly (except, understandably, end of line characters).

    Otherwise, python seems ok. I just wish it had a whitespace-agnostic mode.

    *I* cannot visualy tell the difference between tabs and spaces, why should the programming language?

    --
    In the free world the media isn't government run; the government is media run.
    1. Re:Cryptic whitespace by abigor · · Score: 1, Flamebait

      No, the whitespace enforces legibility when you have a team of 20 people working on the same code. It makes reviews and maintainence go smoothly. The code looks the same. You might have a theoretical issue with it, but in practise it works well and gets working code out the door quickly, which is all that counts, period.

    2. Re:Cryptic whitespace by roscivs · · Score: 2, Informative

      A language which makes a semantic distinction between tabs and spaces may give the appearance of enforcing legibility but in fact does little useful to help legibility.

      A programming language should not make a distinction on meaning based on whether tabs or spaces are used; all whitespace should be regarded equaly (except, understandably, end of line characters).


      Ummm... Python doesn't distinguish between tabs and spaces. I've only written a handful of Python scripts in my life, but I always use spaces to indent, never tabs.

      Furthermore, Python even lets me put in semicolons at the end of my lines. Pretty much the only difference between the way my Python code looks and the way any of my other code looks is that, while the indentation is identical, there aren't any braces in the Python code.
      --
      ~ roscivs
    3. Re:Cryptic whitespace by myowntrueself · · Score: 1

      I've had python scripts give syntax errors on files with mixed tabs and spaces. I believe this is an FAQ.

      --
      In the free world the media isn't government run; the government is media run.
    4. Re:Cryptic whitespace by Chris+Burke · · Score: 1

      A language which makes a semantic distinction between tabs and spaces may give the appearance of enforcing legibility but in fact does little useful to help legibility.

      Well, python's treatment of indentation as block membership is my least favorite thing about it, simply because my editor doesn't know where blocks begin/end if I cut/paste code or add new levels of control flow. I'm not aware of python treating spaces and tabs differently, so i'll take your word for it, and yet nevertheless I can't find this to be an important complaint for one reason:

      You should be using spaces for indentation, and only spaces. If you use tabs, then the code will look different -- and probably ridiculous and broken -- depending on whether or not you view it in emacs, vi, a terminal, a web browser, a line printer, etc.

      There're tons of coding guideline/style issues that I have strong opinions about but will readily concede that it is just my opinion and not necessarily the "right" answer. Spaces vs tabs is not such an issue. There is only one correct answer: spaces. There is no reason not to use spaces, since every real programmers' editor can be set to use spaces when you hit tab.

      Though I will grant that it sucks when you run across code someone else wrote that uses tabs, and if python treats these differently I can only imagine how screwed up it would be -- your belief of how the code is structured from looking at it could differ from the interpreters. Ick.

      I just wish it had a whitespace-agnostic mode.

      I want a mode where it still enforces whitespace, but lets you use curly braces as block delimiters. :(

      --

      The enemies of Democracy are
    5. Re:Cryptic whitespace by myowntrueself · · Score: 1

      Though I will grant that it sucks when you run across code someone else wrote that uses tabs, and if python treats these differently I can only imagine how screwed up it would be

      Thats pretty much the situation I found myself in -- downloaded code which (as it turned out) had mixed tabs and space characters. Then editing it, laying out the code in what *appeared* to be the correct indentation levels and wondering why on earth the interpreter kept barfing at syntacticaly correct code.

      Whitespace should not introduce syntax errors.

      Whitespace has no algorithmic *meaning*, it only has meaning to a human reader, not to a computer.

      Unless its perl with bleach.

      --
      In the free world the media isn't government run; the government is media run.
    6. Re:Cryptic whitespace by pclminion · · Score: 1

      Otherwise, python seems ok. I just wish it had a whitespace-agnostic mode.

      It could be hacked in rather easily. The Python parser, internally, uses two tokens to represent indentation: INDENT and DEDENT. When it sees that a line is indented farther than the previous line, the lexer generates an INDENT, and when it sees a line indented less than the previous line, it generates a series of DEDENT. In this way these two tokens function almost identically to the '{' and '}' braces of C.

      At first I thought there might be an ambiguity in the syntax (since the curly braces are already used in Python for constructing dictionaries). But since dict construction is an expression context and the opening of a control structure looks nothing like an expression context, there would probably be no ambiguity. An interesting little project for somebody with the hots for compilers (which is practically nobody except for maybe me).

    7. Re:Cryptic whitespace by zobier · · Score: 1

      all whitespace should be regarded equaly (except, understandably, end of line characters) No, all \s should be disregarded. That's what [(),;{}] are for.
      --
      Me lost me cookie at the disco.
  47. Re:Cryptic? Complex!? by MoxFulder · · Score: 1

    Sed will do that too:

    sed -i 's/FOO/BAR/g' *

    The review says that the book uses the reader's knowledge of sed, awk, and grep. I figure: why not just use sed, awk, and grep...however, one advantage for Perl here is that (I presume) that line works with any Perl; '-i' is a GNU sed extension and may not work on non-GNU seds...


    Indeed, you're completely right! After 6+ years of using Perl, I no longer use it for anything that sed/awk/grep can't do :-P

    As I've said, Perl was great while it lasted. It's just that there are now better tools for everything it ever did well: sed/awk for super quick and dirty text munging, and Python for everything else.

    (Of course there's also Ruby. I haven't tried Ruby, but my *totally uninformed* impression is that it's a lot less mature than Python, a little more Perl-ish, and the coolest thing on the block right now.)
  48. Re:Cryptic? Complex!? by Scarblac · · Score: 3, Insightful

    I was a Python afficionado, although most of my professional experience was with Java. Then I joined a Perl project. I was open minded, any language can be good in the right hands. Now, two and a half years later, I'm pretty good at it.

    As the team grows, we find ourselves relying more and more on standard techniques. They're not your standard techniques, they're just what we came up with as our standard way. They work well. We have a beautiful object oriented mod_perl/Template Toolkit system, unit tests, RoboDoc, the works. We know how to do this.

    But, exactly as you say, we need coding standards. Lots. Just to make code more comprehensible, it needs to look pretty uniform. We can do that.

    But then, note that objects are just hashes. Sometimes, you get odd data in them, due to some bug. Where did that happen? Of course you use grep, but there are so many ways to put something into a hash, that you run into problems. So you use getters and setters and make sure that all the code everywhere uses them.

    But even things like renaming functions... different calling syntax can make it hard to grep for uses of a function, even. It's getting too ridiculous. Our book of coding standards is getting so thick that we could be coding fucking Java instead, and feel liberated. It's madness.

    So, yes, you can do Perl for larger projects. It's possible. But you have to tie yourself down so badly, most of Perl's strengths as a language can't be used.

    Now I want to get back to Python or Java...

    --
    I believe posters are recognized by their sig. So I made one.
  49. Re:Cryptic? Complex!? by abigor · · Score: 4, Insightful

    His usage of "it's" is correct. It's = it is.

  50. Perl grepping is *slow* by massysett · · Score: 1

    different grep commands such as grep, egrep and fgrep which clearly shows the advantages that Perl has over grep.

    I wonder if the author listed a significant disadvantage of Perl: it is very slow compared to awk and grep. For example: "Notice that Perl requires over sixty seconds to match a 29-character string. The other approach, [used by grep and awk], requires twenty microseconds to match the string. That's not a typo."

    There's nothing like specialized Unix utilities, refined over thirty years with some GNU innovation thrown in, to deliver lightning fast speed.

    1. Re:Perl grepping is *slow* by stu42j · · Score: 1

      I recently switched to a grep replacement written in Perl for most of my code searching needs and can't tell the difference in speed. More importantly, the time it saves ME by doing what I mean is more than worth the additional cpu time required by the computer.

    2. Re:Perl grepping is *slow* by close_wait · · Score: 1
      it is very slow compared to awk and grep.

      Sigh.

      The article shows it being very slow compared to awk and sed for a pathological pattern specifically chosen to make backtracking NFAs like perl/python's look slower. The article has absolutely nothing to say about the relative performance for day-to-day patterns.

  51. mod parent up by Phukko · · Score: 1

    thanks for the links. downloading now. At my present job, there are no *nix boxes and I was getting homesick. Now I've got some shiny PERL for "Winders" to keep me warm.

  52. perl5 has run it's course by mo · · Score: 3, Insightful

    I've been programming perl for 10 years. I've written enough XS modules to be sadly familiar with perlguts and perlapi. I've used perl for a huge array of applications, not excluding some pretty twisted apache hacks using mod_perl. I write perl code every day in my job.

    Lately however, I've grown more and more frustrated with this language. Here's some reasons why:

    muddled standard library While CPAN's depth has been a model for many programming languages to come after perl, it's anarchy kills me. The number of different CPAN modules to deal with time/date manipulation is silly. Newer languages have had the luxury of much more structured standard libraries that make much more sense as a whole. object oriented perl is a hack It may be possible that some very disciplined group of perl programmers have achieved that holy grail of pure OO perl in such a manner that the benefits of OO programming are available to them. In real life, most OO perl programmers are bombarded with example code, third party modules, and CPAN modules that are not OO. Because of this, most perl code falls back on it's procedural roots out of frustration. You can blame this on the programmers, but this doesn't happen nearly as much in Ruby or Python. lack of modern frameworks I'm still waiting for Rails or Django for perl. Catalyst is nice, but a bit disparate, and it just doesn't have the traction or the cohesion that the first-class frameworks do. It used to be that all the cool stuff was done in perl first (example: mod_perl). This isn't the case anymore. bindings for other languages are no longer hard to find It used to be that every cool project/library would only come with perl bindings. Stuff like mod_perl or perl-magick were all you got. These days, however, bindings for other languages are almost just as pervasive, and often better written. For example, the perl AGI bindings in Asterisk PBX aren't nearly as well done or supported as the bindings in other languages.
    1. Re:perl5 has run it's course by chromatic · · Score: 1

      muddled standard library ... While CPAN...

      CPAN isn't Perl's standard library. You might as well complain that any other language allows different people to solve the same problems in different ways.

    2. Re:perl5 has run it's course by mo · · Score: 1

      Ok, then perl's standard library is too sparse.
      Other languages have standard libraries that define a wide array of functionality in very consistant interfaces.
      In perl, you're going to have to go to CPAN for stuff that other languages do in their standard library:

      * manipulating, parsing, and other oprations on times/dates
      * SHA1 sums
      * sending/formatting email

      Most languages (python for example) have these functions in their standard library. If they don't, there's at least a favored implementation to use instead of a number of disparate modules with slightly different methods of doing the same thing (eg: perl's Mail::Mailer vs Mail::Send).

      The problem here is that perl blazed the trail that all interpreted languages since have followed. However, they get the benefit of learning from perl's mistakes.

    3. Re:perl5 has run it's course by doom · · Score: 1

      In real life, most OO perl programmers are bombarded with example code, third party modules, and CPAN modules that are not OO. Because of this, most perl code falls back on it's procedural roots out of frustration. You can blame this on the programmers, but this doesn't happen nearly as much in Ruby or Python.

      What it might be is that OOP itself has been over-sold as a holy grail, and it's not such a bad thing to be able to bail on it and write proceedural code.

      Or for that matter, functional code: Higher Order Perl.

    4. Re:perl5 has run it's course by Watson+Ladd · · Score: 1

      So where is call/cc, garbage collection, static typing, formal semantics, point free style and the other trappings of functionality? When can I implement my own thread library using only core language constructions? Perl might permit functional programing, but it has a ways to go.

      --
      Inventions have long since reached their limit, and I see no hope for further development.-- Frontinus, 1st cent. AD
  53. Re:oh come on, you're not even trying now by qwijibo · · Score: 1

    I would argue that the majority of business people hiring programmers to work cannot tell the difference between a well designed solution and a horrible kludge. The horrible kludge will always take less time in the short term than the well designed solution. Business people have no long term memory and only acknowledge short term goals. A horrible kludge is a cost effective short term solution.

    Therefore, one can reasonably conclude that in many environments, Perl is an ideal tool for the problem at hand. It can be used in ways that are not horribly short sighted, but it's flexible enough to still be useful in the situations that are.

    Then again, my view of the world may be skewed by having spent too much time working for people who believe that russian roulette is the only viable way to make decisions. It's always worked in the past and the brain dead cannot be harmed by the game, so we don't do backups of our production databases. Our disaster recovery plan is to drive across town and get a job at a company that didn't have a disaster. I'm not kidding, we have senior VP level support (working in a bank) for this plan.

  54. minnie pearl by trb · · Score: 1
    It's about time Minnie Pearl got some attention around here.

    http://en.wikipedia.org/wiki/Minnie_Pearl

  55. Arguably... by Limecron · · Score: 0, Flamebait

    "Perl (Practical Extraction and Report Language) -- the language which was created by Larry Wall is arguably one of the greatest programming languages."

    Hmm, kinda like George W. Bush is arguably one of the greatest presidents.

    Sorry, couldn't resist. :)

    1. Re:Arguably... by doom · · Score: 1

      Limecron wrote:

      "Perl (Practical Extraction and Report Language) -- the language which was created by Larry Wall is arguably one of the greatest programming languages."

      Hmm, kinda like George W. Bush is arguably one of the greatest presidents.

      Sorry, couldn't resist. :)

      Godwin!

  56. What I love most about Perl is it's SPEED! by clayne · · Score: 2, Funny

    (yes I pre-ran them both multiple times to reduce cache affects)

    [src] $ time perl -e '$tdata = "../../tests/ctok.in.2"; $sz = -s $tdata; print "sz == $sz\n"; open(FH, $tdata); while (<FH>) { @t=split(/[ :#]+/, $_); $c += $#t; } print "c == $#t\n";'
    sz == 96252007
    c == 12301001

    real 0m31.877s
    user 0m31.662s
    sys 0m0.148s

    [src] $ file ctok
    ctok: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, not stripped
    [src] $ time ./ctok ../../tests/ctok.in.2 " :#"
    sz == 96252007
    c == 12301001

    real 0m2.417s
    user 0m2.280s
    sys 0m0.132s

    And yet I still proudly use C. Let the prophets K&R reign supreme.

  57. Strategies for complex perl code bases by doom · · Score: 3, Insightful

    But then, note that objects are just hashes. Sometimes, you get odd data in them, due to some bug. Where did that happen? Of course you use grep, but there are so many ways to put something into a hash, that you run into problems. So you use getters and setters and make sure that all the code everywhere uses them.

    That's a pretty common way of implementing objects in perl, but it is, of course, not the only way... The current thinking seems to be we should all switch to using "Inside-Out Objects" (briefly: object data is moved to class data, and the object only needs to be a unique id to pick out the correct values from the class data -- so you bless a scalar ref, and get a lightweight object which stringifies to a unique id). The point being that if you do things this way, you really *have* to use the accessors, you can't cheat and treat the object as a hash reference any more. Unfortunately, last I looked there was some argument about what precisely was the right way to do this (there's some issue with thread support), though the best publicized way of doing it certainly the one recommended by Damien Conway in his newish book "Perl Best Practices".

    If you're not interested in re-writing your entire code-base to conform to someone's notion of "Best Practices", myself I might suggest looking into "lock_keys" in the Hash::Util module. You could adopt the practice of doing a lock_keys on the hashref at the end of the object/creation initialization stage, and then if anyone accidentally tries to create a new hash field later, it will throw an error. A simple, effective trick, and I wish it were better publicized...

    On occasion I wonder how hard it would be to write an automated test that would look for cases where someone has done a "$obj->{hash_field}"...

    In general, coding standards are important, and where the language is really flexible, they arguably become even more important -- but I think a lot of that problem can be solved with some good automated testing. For example, there's a CPAN module called Perl::Critic that will do things for you like check to make sure your code matches a given set of coding standards (it defaults to Conway's "Best Practices", as I remember it).

    1. Re:Strategies for complex perl code bases by Scarblac · · Score: 1

      Thanks for the comments!

      The idea of blessing a scalar as an index is new to me, an interesting concept. It's going to be hard to use that in any short time frame, but who knows, we might be able to refactor it in over time :-) I actually ordered the book recently, it hasn't arrived yet. I wasn't expecting anything special, but apparently I'm underestimating it.

      As for Perl::Critic, I think I'm going to play with that tomorrow, sounds fun, never thought to look for something like it! Thanks!

      --
      I believe posters are recognized by their sig. So I made one.
    2. Re:Strategies for complex perl code bases by chromatic · · Score: 3, Informative

      You could adopt the practice of doing a lock_keys on the hashref at the end of the object/creation initialization stage, and then if anyone accidentally tries to create a new hash field later, it will throw an error. A simple, effective trick, and I wish it were better publicized...

      Hey, that's Perl Hack #87!

    3. Re:Strategies for complex perl code bases by MoxFulder · · Score: 1

      That's a pretty common way of implementing objects in perl, but it is, of course, not the only way... The current thinking seems to be we should all switch to using "Inside-Out Objects" (briefly: object data is moved to class data, and the object only needs to be a unique id to pick out the correct values from the class data -- so you bless a scalar ref, and get a lightweight object which stringifies to a unique id). The point being that if you do things this way, you really *have* to use the accessors, you can't cheat and treat the object as a hash reference any more. Unfortunately, last I looked there was some argument about what precisely was the right way to do this (there's some issue with thread support), though the best publicized way of doing it certainly the one recommended by Damien Conway in his newish book "Perl Best Practices".

      This is a pretty interesting idea. One thing is for sure, the Perl community has no shortage of interesting and thoughtful ideas about data structures and different ways of interacting with them. It makes for some good reading.

      One problem I see with "inside out objects" is that they could wreak havoc on the ability to serialize Perl objects for persistent storage in a DB via freeze/thaw. All you'll end up storing is an index into a non-persistent table, unless yet-another-glue-module is written to provide for the serialization of such objects.

      The Class::* modules do a pretty good job of standardizing appropriate interfaces to Perl objects, I think. But it seems that every *useful* high-level module uses a different subset of them :-(
    4. Re:Strategies for complex perl code bases by chromatic · · Score: 1

      All you'll end up storing is an index into a non-persistent table, unless yet-another-glue-module is written to provide for the serialization of such objects.

      It's even easier as that. All you need is to add freeze() and thaw() methods, and you can get those almost for free from Class::Std.

  58. Re:oh come on, you're not even trying now by notwrong · · Score: 1

    Perl's "TMTWWTDI" actually DOES keep it simple. It allows you to adapt a specific style, and consistently use it. Fair enough. But if you are using another language without this 'feature' you consistently use a standard style anyway. The benefit in that case being that other people can read your code without having to adjust to your idiosyncratic style.

    Perl is the only language I have used that I can walk away from for a year, and then use it again WITHOUT having to touch a book or online manual.

    I suspect this is due to your familiarity with the language. I find that this is true of C for me (though not C++). I have not stopped using Python since I first switched to it (from Perl) around two years ago, but I can't imagine I would have any trouble picking it up again immediately, should someone force me off it against my will.

    My recent experience with having to pick up Perl again is that Perl programs I wrote only two or three years ago are extremely difficult to understand now - and I tend to comment heavily, and to use a C-like style to keep it familiar.

    BTW it's not just Perl that I find hard to pick up after a break. Java's syntax I am fine with, but you always need the API open in a browser, and I find myself checking it even for basic things if I haven't done much Java in a while. Prolog is very hard to re-adjust to (probably the whole non-imperative thing), and all the intricacies of C++'s syntax and the STL seem to wind up with me spending at a lot of time with Google and various (cryptic) documentation.

    What, exactly, does Perl's use of non-text characters have to do with consistency? BTW, ever try to write C code without (){}+=-*? Thought so.

    You are right about the C of course, all programming languages have non-alphanumerics throughout them. I think what he meant though, is that Perl is kind of extreme in this regard. The requirement for prefixing every variable with $ or @ or %, which changes depending not only on the variable, but also what you are doing with it, and allowing multiple variables that differ only in this changeable symbol... it's just not great for consistency. The default operations on $_ and such can also be very hard to follow when you are not inside the original coders head. I think that Perl's regular expressions are very powerful, and are largely responsible for upgrades to the regular expression capabilities of other languages. However, I think the way they are such a core part of the syntax does hurt intelligibility of the code. I would prefer they were in an external module with decent object-oriented semantics, such as in Java or Python.

    And I know it seems like I'm plugging Python, (there's no zealot like a convert) but the lack of this level of unpronounceable ascii art helps readability immensely. Python has been called executable pseudocode, and it isn't that far off sometimes.

  59. Re:Cryptic? Complex!? by jez9999 · · Score: 3, Insightful

    If only Python didn't require the use of whitespace for defining blocks. It is indeed tragic that an otherwise fine language is so goddamn retarded in that one aspect.

  60. PseudoHashing by goombah99 · · Score: 1

    Another way to lock a set of keys that works at "compile" time rather than runtime (that is it works on the class and not the instance, is to use pseudohashes. This actually makes the code faster too. Effectively what it is doing is using an array rather than a hash and all the keys are like enums. But all that's hidden behind a layer of syntactic sugar so it looks just like a normal perl hash-based object.

    --
    Some drink at the fountain of knowledge. Others just gargle.
    1. Re:PseudoHashing by chromatic · · Score: 2, Insightful

      Actually, pseudohashes made everything slower, so they've been long deprecated and won't be in Perl 5.10.

  61. Until something happens to the code, yes by Wee · · Score: 1
    No, the whitespace enforces legibility when you have a team of 20 people working on the same code. It makes reviews and maintainence go smoothly. The code looks the same. You might have a theoretical issue with it, but in practise it works well and gets working code out the door quickly, which is all that counts, period.

    The problem I have with python (other than the lack of autovivication and CPAN) is that the whitespace can almost be thought of as non-portable metadata. The minute someone tries to paste a python code snippet into an online form, into an email, in a jabber session, etc. you start having problems. Have you ever had to unravel a few hundred lines of twice-quoted, emailed python? It can be a royal pain. Even if you have 20 people working out of the same SCC repository, you have to hope/require that they all use the same editor (or same editor settings). I've seen changes in wordwrapping and confusion over spaces/tabs cause problems.

    Because there's nothing which lets you know where the logical blocks should be once the indenting has been fubar'ed, you have to enforce constraints on both use and handling. IMHO, those same use constraints applied to perl gives you a lot in terms of readability, and there are no real handling issues to deal with.

    Having said that, I like python a lot. It's easy to learn, fun to program in, and the core gives you a lot of tools. Stuff like slicing strings like arrays is terribly handy as well. And the OO part is very clean and powerful and a joy to use compared to perl's (which I never really liked very much). Anyway, YMMW.

    Disclaimer: I first started writing perl back in 1994, as my 3rd language (though it was the first I got paid to write). I write almost exclusively in python now.

    -B

    --

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

    1. Re:Until something happens to the code, yes by newt0311 · · Score: 1

      simple and very effective solution is to get rid of all tabs and replace them with 4 spaces. suddenly, the editer or whatever doesn't make a difference. Tabs are evil anyway. They are too inconsistent across platforms to be useful and should be removed quickly.

  62. Re:Arguably one of the greatest? by ForumTroll · · Score: 1

    Not that I completely agree with the grand parent post, but who cares if they aren't main stream languages that are in extremely heavy use? PHP is a language lots of people use and it's a total piece of shit. Sure, Haskell, OCaml, Lisp etc. might not be used for writing the majority of simplistic CRUD web applications, but all of the languages the grand parent mentioned are seeing use in some of the more interesting areas of programming. For example, lots of the really interesting AI research right now is being done with Lisp. Personally, I'd rather be doing stuff like that instead of pumping out basic CRUD web applications with the "main stream" languages (Java, C#, PHP etc.) like the majority of programmers are currently doing.

    P.S. I use Haskell at work daily and it's quite nice.

    --
    "A Lisp programmer knows the value of everything, but the cost of nothing." - Alan Perlis
  63. Re:Cryptic? Complex!? by Chris+Burke · · Score: 1

    About a year ago I decided to give Python a try. And I haven't looked back. It can do everything Perl can do, and then some. Everything is clearer and having a "standard" way to do most things makes learning new modules immensely easier. Having slightly more verbose syntax and strict type-checking is slightly annoying at first, but keeps me sane in the long run.

    Basically I don't use perl for anything other than one-liner regexp tricks anymore. Stuff like perl -i -pe 's/FOO/BAR/g' *, which will change the string FOO to BAR in all the files in the current directory.


    Yeah, pretty much the same story here, though I was never as professionaly invested in Perl. Loved it though, and still use it for one-off command line things. Pretty much any time I had to write or deal with someone else's Perl program that was more than 1000 lines, it simply became unmanageable too fast. I could leave a 100k line C program for a couple months, and at least be able to pick it back up quickly. A mere 10k Perl program was basically unreadable to me after a long weekend. Then finally I was given an opportunity to learn Python for a project at work, the purpose of which was to re-write an old Perl program that we wanted to add features to but nobody understood anymore. Hooray for getting paid to enhance my resume! But anyway...

    I now love Python. It's great. Got some quirks, but generally makes sense, and I also like how easy it makes working with arrays, creating arrays on the fly, splicing arrays, and so on. Highly recommend it to anyone who has ever said "I like Perl, I just wish I could read it after a bender".

    However there is one thing I don't like about Python. And it's the first thing anyone coming to Python first says "Whaaaaa?!" to. Which is: indentation defines blocks.

    Now don't get me wrong, it's not so much the enforced importance of indentation. I always religiously indent my C code, and nothing is more obnoxious than finding half a dozen closing braces all at the same level of indentation. It's the absence of block-enclosing characters that I don't like. Block enclosing characters make it simple -- for humans and for machines -- to determine where a block begins and ends. With C, if I want to move a block of code I simply cut/paste it, hit my re-indent macro, and bam I'm done. With Python, I have to manually indent the block after I paste it, because for my macro to figure out what the new indention should be it also needs to know what the intended semantic meaning of the code is, because it would basically be deciding where the blocks begin and end. C explicitly encodes this information, so my macro doesn't have to figure anything out. Adding/removing a nested 'if' is a similarly annoying case.

    Basically, all I want is Python with curly braces. You can even make the interpreter barf if my indentation doesn't match what my braces claim the blocks are.

    Also I should say that this is a fairly minor issue, and shouldn't be a reason to avoid Python.

    --

    The enemies of Democracy are
  64. Want unicode? Try tcl by 198348726583297634 · · Score: 1

    Subject says it all - tcl has the best unicode support you'll find in a scripting language. Python? Sorry, nice try, tcl has it beat.

    Tcl is also sophisticated enough to support numerous programming paradigms with ease, but its complete syntax is just eleven rules long. Add to that the astoundingly helpful wiki and a powerful cross-platform GUI toolkit and you won't often need to turn to other languages for your programming needs.

  65. Re:Cryptic? Complex!? by Anonymous Coward · · Score: 0

    Luckily, everyone else has gotten over their obsession with curly braces. If only you could get over yours...

  66. Excesive verbiage by Logic+and+Reason · · Score: 1
    To the author of this review: you need to cut out about a third of the words you use. For example:

    Perl (Practical Extraction and Report Language) -- the language which was created by Larry Wall is arguably one of the greatest programming languages. But it has a reputation for taking an excessive cryptic nature which gives it an image especially among Perl novices as a language which is complex and hard to master. Minimal Perl: for Unix and Linux people, authored by Tim Maher and published by Manning Publications addresses the obstacles presented by Perl's complexity. This book which is divided into two parts comprising of a total of 12 chapters takes a unique methodology to explain the Perl syntax and its use. The author emphasizes on Perl's grep, awk and sed like features and relys on concepts such as inputs, filters and arguments to allow Unix users to directly apply their existing knowledge to the task of learning Perl.
    could be shortened to:

    Perl's reputation for crypticness gives some people the impression that it is complex and hard to master. "Minimal Perl: for Unix and Linux people," by Tim Maher and published by Manning Publications, addresses this impression. The book, divided into two parts comprising 12 chapters total, explains Perl's syntax and use in a unique way. The author emphasizes Perl's grep-, awk- and sed-like features and uses concepts like inputs, filters and arguments to allow Unix users to apply their existing knowledge to Perl.
    This is Slashdot. We don't need you to tell us that Perl is "arguably one of the greatest programming languages," that Larry Wall created it, or that its name stands for "Practical Extraction and Report Language," and those tidbits are irrelevant to the review in any case. The rest of the blurb contains far too many empty words. If you can cut even one useless word from a piece of technical writing, you've saved every member of your audience a bit of time, and you've increased the chances that people will actually read what you've written.
    1. Re:Excesive verbiage by takeya · · Score: 1

      We used to be innocent and play with eachother. We didn't think much of it at the time - what felt good was right, back then. Now we're indoctrinated with societal constructs and, what I find to be, frankly, insufferable ideas about tolerance and leadership. The ultimate role that such constructs play today is rather laughable in comparison to the sheer number of those who blindly follow these veritable dictats, without so much as questioning whether they produce dissonance. Illiteracy rates are skyrocketing, and those that do choose to learn the dying art choose to waste it away on topics that aren't even worth inquiring about any longer, they've been milked dry. The few, elite that choose to pursue careers, viz, those that gain enough expertise and passion about the art tend to find themselves weary and unable to see the forest through the trees. The expression that best defines their state of being is kafkaesque, at best, and at worst, well, treading there is not on our agenda today. The group of those that inquire and research against fields in which there is not an exponentially increasing amount of noise tend to find themselves grasping for meaning within the words in front of them. Their minds see but they fail to interpret what they read into meaningful concepts. The art is right there, right in front of these jovial folks, but their untrained eye is unable to see it, rendering in and of itself an utterly lost and irretrievable expression of one's inner being. Perhaps futuristic peoples will remand the task to those who they consider apes - the very scholars who are pursuing a livelihood in the study of the very concepts which have been lost. Such peoples will need only a morsel of the vast intelligence that can be offered by those not of the location at which there is currently inhabitance known to us, that they will bestow upon their slaves, albeit, their masters themselves, little beknownst to them, the understanding and visual perception necessary and requisite to comprehending this vastly intuitive creation, generated as if by chance by those who are now known to have once been at this place, but are now known to no longer frequent it. The ultimate concept that has been herein attempted to convey is that once the data is transferred to a subsequent and more inherent being there will be no sentience that isn't lost, except that which has not yet been produced. In fact, I retract, dare, there may be nothing lost as in the necessary requirements for losing a posession, viz, an item posessed by those who intend to continue such act, including but not to forget that there are in no way limits to this definition beyond normal grammatical restraints, that data once processed is of the only type which can currently be called irretrievable in the future. Once it becomes an item catalogged in the reaches of the beyond, we may see that there is no limit to the expansion of the creative, the intensely devoted, in the way that there are no constraints thereupon. I thank you for your time.

  67. Re:Want unicode? Try tcl by CRCulver · · Score: 1

    Where are the third-party tcl libs?

  68. Damn right - mod parent up by Kittenman · · Score: 1

    Thanks from me for the links too. No more Notepad for Perl scripts. I always suspected that there was a good editor out there (and some snappier doco). Downloading now...

    --
    "The greatest lesson in life is to know that even fools are right sometimes" - Winston Churchill
  69. Re:Cryptic? Complex!? by swillden · · Score: 1

    If only Python didn't require the use of whitespace for defining blocks.

    What's wrong with it? I have only written a few thousand lines of Python, but I quite like the indentation-based block structure. I thought it might be error-prone, but I've never experienced any trouble with it. What do you dislike about it?

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  70. Re:Cryptic? Complex!? by MoxFulder · · Score: 1

    Now don't get me wrong, it's not so much the enforced importance of indentation. I always religiously indent my C code, and nothing is more obnoxious than finding half a dozen closing braces all at the same level of indentation. It's the absence of block-enclosing characters that I don't like. Block enclosing characters make it simple -- for humans and for machines -- to determine where a block begins and ends. With C, if I want to move a block of code I simply cut/paste it, hit my re-indent macro, and bam I'm done. With Python, I have to manually indent the block after I paste it, because for my macro to figure out what the new indention should be it also needs to know what the intended semantic meaning of the code is, because it would basically be deciding where the blocks begin and end. C explicitly encodes this information, so my macro doesn't have to figure anything out. Adding/removing a nested 'if' is a similarly annoying case.

    Indeed, this is the only thing I mind about indentation in Python: it makes it hard to cut-and-paste code. Fortunately, Emacs has rectangle mode which I find very helpful in indenting a bunch of lines together all at once (C-x t SPACE SPACE SPACE SPACE ENTER to move them all 4 spaces forward, for example).

    It's also hard to take Python code from web forums, since the indentation often gets lost in HTML, and you have to View Source to get them.

    But I agree that it's a minor issue too, and in all other circumstances I have grown to enjoy the lack of curly braces.
  71. Re:Cryptic? Complex!? by Anonymous Coward · · Score: 0

    it's so easy to right totally unmaintainable, totally unreadable code.

    Spoken like a true perl haXX0rz

  72. Re:Arguably one of the greatest? by newt0311 · · Score: 1

    what about the several thousands of lines of lisp code on my PC and on the PC of everybody who uses emacs?

  73. Re:Cryptic? Complex!? by MoxFulder · · Score: 2, Interesting

    But even things like renaming functions... different calling syntax can make it hard to grep for uses of a function, even. It's getting too ridiculous.
    This was one of the things I noticed immediately when poking around in the Python standard library... it's quite easy to find where functions are called and defined. Just grep for "function\s*(" or "def function". It's always on one line. The parentheses are always there. It jumps out visually. Nice.

    Our book of coding standards is getting so thick that we could be coding fucking Java instead, and feel liberated. It's madness.
    ROTFLMAO

    So, yes, you can do Perl for larger projects. It's possible. But you have to tie yourself down so badly, most of Perl's strengths as a language can't be used.

    You've put your finger on it. Perl has many cool features, great strengths, and great depth. But it gives you almost no restrictions on how to combine them. Seductive, but not so good in the long run.
  74. Re:Cryptic? Complex!? by Chris+Burke · · Score: 1

    Fortunately, Emacs has rectangle mode which I find very helpful in indenting a bunch of lines together all at once (C-x t SPACE SPACE SPACE SPACE ENTER to move them all 4 spaces forward, for example).

    Do you know the function name? It isn't mapped to C-x t in my emacs. If there was a way to de-indent (backspace instead?) that would probably solve most of my issues.

    --

    The enemies of Democracy are
  75. I really want to know... by jozeph78 · · Score: 1

    If I'm well skilled in BASH plus sed and awk, what does perl buy me?

    --
    Ever done a `man` on `top` ?
    1. Re:I really want to know... by doom · · Score: 2, Insightful

      If I'm well skilled in BASH plus sed and awk, what does perl buy me?

      1. You immediately get some efficiency gains in the form of code run times, because you're not using six processes every time you turn around;
      2. Having everything inside the one process means the pieces can all talk to each other easily (you're never stuck trying to figure out how to get a piece of data jump from one part of a chain of pipes to another);
      3. Perl regular expressions are very powerful compared to the existing tools, and once you get used to them you can start forgetting the multiple flavors you're used to;
      4. Perl is arguably the best documented language ever -- the O'Reilley books are largely excellent, the books from other companies (like the one under review) are often pretty good too, and the on-line documentation is also quite complete (including a number of tutorials on different subjects);
      5. Perl scales upward to fairly large projects (compared to bash/awk) -- just how large is a matter of some debate, but if you get interested in doing something a little heavier than sysadmin work you can continue to apply your perl skills;
      6. There's a large quantity of existing packages out on CPAN, to the point where it's difficult to think of something worth adding to the collection -- the problem with perl is rarely "where will I find something like this", it's more like "how will I evaluate the six existing solutions"?
    2. Re:I really want to know... by VGPowerlord · · Score: 1

      The first thing that comes to mind is database connectivity.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    3. Re:I really want to know... by dfdashh · · Score: 1

      How about that Perl ships with a debugger? How many times have you had to kludge your way through Bash/KSH code? For me, too many.

      --
      df -h /my/head
    4. Re:I really want to know... by jozeph78 · · Score: 1

      All these things are great, especially db connectivity, but we are talking about minimalist perl for the use of Unix and Linux. What business does my OS have reading from or to a table? I would sooner have my database talk to the OS. For parsing or regex replacement awk and sed do me quite well, and Bash binds them all amongst the other 100's of shell utilities.

      IMHO, I'll stick to the shell for system level. If I needed something more complex I would code it in another language, perhaps even perl, but the test sell it as a replacement to shell scripting. "The author emphasizes on Perl's grep, awk and sed..." So what do these Perl versions to except require me to learn what could be argued as one of the sharpest scripting languages around.

      As far as debugging, bash -x has served me well because I've never gone overboard and used it against it's intent. If it's more involved, I'll write it in something else; perhaps but not necessarily Perl.

      --
      Ever done a `man` on `top` ?
    5. Re:I really want to know... by bill_mcgonigle · · Score: 1

      5a. It's much easier to do code reuse with Perl than bash/sed/awk. You can easily write a module that can be called from a commandline script, a GUI application, loaded into an Apache module, or even inherited from, all of which are hard with the traditional script tools.

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    6. Re:I really want to know... by VENONA · · Score: 1

      There are a couple of sample chapters available.
      http://manning.com/maher/ch03.pdf
      is all about using perl as a better grep'ing engine--better in *many* ways. It's 39 pages of goodness, and what convinced me, rather than the review here. YMMV, but I've been burned by portability issues in various flavors of shells, greps, and other tools.

      At the moment:
      man -k grep |grep ' (1' | wc -l
      16
      but I've also worked with systems where that would have returned 3--and they were all incompatible with their 'equivalents' on this machine.

      Then there are the vast differences in shells, ad nauseum. If you only work with one Unixy OS, it's probably not a big issue for you, though it might still make things easier, depending upon exactly what you do. But many people who've made the intellectual investment to acquire decent bash, awk, and sed skills are also working across disparate environments. Perl can cut down on the combinatorial explosion of syntax differences across the various tools.

      I still use grep (and some others) all the time, as in the example above. I'm not arguing that Perl should be treated as a complete replacement for grep and other tools. But it sure can simplify your life, particularly as it's widely installed. For instance, I do a lot of work with minimal or close to minimal (hardened) Linux systems. On some SuSE systems I'm currently dealing with, you don't get Python in that configuration, but you do get Perl.

      It's not a perfect solution, by any means. At least one commercial Unix system I have to deal with doesn't provide Perl by default, and policy prevents me from installing it. Some modules on the CPAN are, IMO, crappy enough that I don't *care* whether they're portable. I have other complaints. But there've been many situations where Perl saved either time, or my ass.

      BTW, on the site mentioned above, there's an ebook version for $22.50, a source code download, etc. It's worth a look, if for no other reason that the sample chapters are informative and enjoyable.

      --
      What you do with a computer does not constitute the whole of computing.
  76. Re:Cryptic? Complex!? by MoxFulder · · Score: 1
    Hey, that's my bad. It is in fact, C-x r t (all the rectangle-mode commands are under C-x r). The complete function description:

    C-x r t runs the command string-rectangle
          which is an interactive compiled Lisp function in `rect'.
    (string-rectangle START END STRING)

    Replace rectangle contents with STRING on each line.
    The length of STRING need not be the same as the rectangle width.

    Called from a program, takes three args; START, END and STRING.


    Similarly, the C-x r k command will delete an entire rectangle of spaces. I use that frequently to de-indent whole regions of code. Hope that helps.
  77. Re:Cryptic? Complex!? by Coryoth · · Score: 2, Informative

    Indeed, this is the only thing I mind about indentation in Python: it makes it hard to cut-and-paste code. Fortunately, Emacs has rectangle mode which I find very helpful in indenting a bunch of lines together all at once (C-x t SPACE SPACE SPACE SPACE ENTER to move them all 4 spaces forward, for example).

    Hmm, that seems a round-about way to do things. I presume you never happened to run into some of the nice features in Emacs python-mode, specifically python-shift-left and python-shift-right which will move the selected region left or right one python indent (that is, as many spaces as you have set for your block indentation in python-mode). Usually these are bound to "C-c <" and "C-c >" which lets you easily select a region (such as a pasted block) and move it to the correct indent level very quickly.
  78. Re:Cryptic? Complex!? by MoxFulder · · Score: 3, Insightful

    If only Python didn't require the use of whitespace for defining blocks. It is indeed tragic that an otherwise fine language is so goddamn retarded in that one aspect.

    You know, it seems like *everyone* is put off by this aspect of Python at first. The first time I looked at it, it drove me nuts, and then I ignored Python for another two years.

    But once I actually tried to write a program in Python, I found I didn't mind it one bit. Within a few hours my eyes didn't get confused by the lack of braces. I think it's actually easier on the eyes once you get used to it.

    So I can't say, "don't knock it", because I've done that myself for sure. But do give Python another look, maybe play around with the tutorial for an hour or two.
  79. Re:Cryptic? Complex!? by MoxFulder · · Score: 1

    Hmm, that seems a round-about way to do things. I presume you never happened to run into some of the nice features in Emacs python-mode, specifically python-shift-left and python-shift-right which will move the selected region left or right one python indent (that is, as many spaces as you have set for your block indentation in python-mode). Usually these are bound to "C-c " which lets you easily select a region (such as a pasted block) and move it to the correct indent level very quickly.

    Wow! That does the trick nicely. Thank you very much, that makes things even easier. And who says you'll never learn anything on slashdot?
  80. Re:Cryptic? Complex!? by Anonymous Coward · · Score: 1

    It doesn't "delete" the entire rectangle, it cuts it to the rectangle kill ring. You can get it back with C-x r y. I love rectangle editing in Emacs!

  81. Re:Cryptic? Complex!? by Chris+Burke · · Score: 1

    Hope that helps.

    Sure does! Thank you.

    --

    The enemies of Democracy are
  82. I like python, but... by Junta · · Score: 1

    My problem is some libraries I started getting into either didn't have python equivalents or the python equivalents were inconsistent. I'm trying to write software that will work with the greatest variety of distributions, and across the board the perl module variants are widely available and consistent. In python, some things aren't quite there, and some important modules have subtly different syntax between the distributions I need to support, all of which deviate from what you would download from upstream python world today. For 1 out of 5 lines of code in a particular python module I was writing, I was having to write the same thing three times in slightly different ways depending on the detecting version of the library. Didn't last long before I ditched that and ran to perl for this project despite my longstanding python experence.

    I moved *to* perl from being an entirely python guy (started into perl and was 'ok' at it, but went to python for the same reasons a *lot* of people do). Python code is easy to write, but more importantly, *forces* writers to write code that is maintainable by others. Well, obfuscated python is possible, but with perl it's easy to casually fall into writing obfuscated code...

    A lot of the perl culture doesn't help. If someone posts code to do something that is fairly reasonable, they may be mocked by another developer for not doing it in this hard to read/follow one liner they declare is 100% better because it fits on one line without a ; and uses no explicit variables...

    I do have to acknowledge that perl doesn't *have* to look funky, most of the time you can make it fairly readable. Writing OO stuff is kinda weird as it feels like syntax that just happened to work really intended for cleanly packaging their version of include files. Variable referncing/dereferencing isn't all that different from C, but the function prototypes invite aggravation (values can be forced to be by reference without the caller realizing it, for example).

    For my part, I try to write sane/legible perl. I try to be careful about indentions, I avoid almost entirely the likes of $_ and similarly invisible evocations of it which become hard to follow in all but the shortest loops, and when faced with anything but the simplest usage of it, I avoid using features of perl like map that tend to confuse people, and use more long-winded, but easier to follow conventions to get the job done.

    --
    XML is like violence. If it doesn't solve the problem, use more.
    1. Re:I like python, but... by chthon · · Score: 1

      Perl Best Practices by Damian Conway and Perl::Critic.

    2. Re:I like python, but... by Anonymous Coward · · Score: 0

      "A lot of the perl culture doesn't help. If someone posts code to do something that is fairly reasonable, they may be mocked by another developer for not doing it in this hard to read/follow one liner they declare is 100% better because it fits on one line without a ; and uses no explicit variables..."

      Oh come on!

      Where has that ever happened?

      I've been using Perl for 10 years, not once has that happened - you know what I find about the Perl Culture?

      I find that Best Practice is encouraged and evangelised - that means not only are people encouraging you to unit, regression and smoke test, but that people are writing tools, and offering to help.

      I find that when I release a module to CPAN it is automatically smoke tested and any failures reported back to me, and that people use rt.cpan.org to report errors, and provide patches and suggestions.

      I find that when I get stuck people help me, almost always without being smarmy or showing off.

      I find that the CPAN packages that are well regarded in the community are not only reliable and well tested, but are supported by mailing lists, websites and wiki's, and that they are easy to discover through reading community resources like use.perl, and perlmonks - or by checking Ratings and reviews, or by checking the modules "Quality".

      I also find that I haven't had to use the OO syntax you find so hard (despite it being very simple), because Reusable OO Classes on CPAN provide me with constructors, accessors, persistance, searching, serialisation, etc and I can even combine these with Traits using Class::Trait.

      What's more we happen to be working with very large and very important data sets in Perl - I'm using it to collect, process and report aviation data for pilots and airlines, one of my best friends is using it at the Sanger Institute to process DNA data for genome research, and I know it's used by other friends of mine for critical banking and billing tasks.

      --
      Aaron Trevena, BSc Hons
      http://www.aarontrevena.co.uk/

  83. Re:Cryptic? Complex!? by jez9999 · · Score: 1

    What do you dislike about it?

    The two things that come to mind:
    1) You can't put more than 1 statement on the same line as an 'if' or 'else'. "if (increment_them) {a++; b++;}" won't fly. Some people might think that's good, I think it's limiting.
    2) Mixing spaces and tabs for indentation is a MAJOR no-no. If my text editor has tabsize 4, and somebody used 4 spaces to indent one block, if I try and indent the next block down with 2 tabs (8 spaces on my text editor), what does Python do? Someone else's text editor might display tabs as 2 spaces. Sure, you can try and mandate that everyone use tabs or spaces for indentation, but it's just a potential headache that wouldn't be there if Python weren't so stupid.

  84. Re:Cryptic? Complex!? by Jeffrey+Baker · · Score: 0

    Sure, C has a huge space of implied variables. You can read from any memory location, and cast it to any type. It's completely ridiculous, much worse than Perl.

  85. How much does this Mini Perl book cost? by Anonymous Coward · · Score: 0
    $1.89?

    How-DEEEE!

  86. Not one of the greatest by kindbud · · Score: 1

    "Perl (Practical Extraction and Report Language) -- the language which was created by Larry Wall is arguably one of the greatest programming languages. But it has a reputation for taking an excessive cryptic nature which gives it an image especially among Perl novices as a language which is complex and hard to master.


    That's because it's just complex and hard to master, and not really all that great.

    --
    Edith Keeler Must Die
  87. Re:Cryptic? Complex!? by clayne · · Score: 1

    It's completely obvious what's going on just by reading the code.

    If a programmer just randomly reads x memory location and casts it to y for apparently no reason whatsoever, then that's just stupid code and a bad example.

  88. Re:Cryptic? Complex!? by jellomizer · · Score: 1

    How do you avoid using regular expressions?
    Well most languages have these things called functions, you can use them to do your own string functions. Other Languages have a bunch of well performing string functions so I don't need to program them myself. Other languages have different Datatypes like Lists which I can convert a string to and do a lot of calculations based on these data types. While they may not be as efficient as Regular Expressions they are better in readability for programmers in different skill sets.

    Well Binary Information In languages such as C you use the \char for a lot of characters that are beyond the normal keyboard typing. so if you have a bunch of them they really do look similar to an other language asking for characters beyond normal typing. Now these characters are often handled in 8 bit ASCII so if you need to handle data in the binary level you may use these characters to handle the sequences. even if you are dealing with Hex information you still use a syntax similar to Regular Expressions. No this is not really binary in the sense that I am handling the 1 and 0 independently. But in technical terms we often data Binary Data for Data that is beyond your keyboard typing. As opposed to say Text Data which is data you can type on a normal keyboard.

    If you were any type of professional level programmer you would know this. Yes I Can program Regular Expressions in my code, I don't like them because it makes code ugly. Guess what there are other ways of writing code and there are good reasons for writing code differently.

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
  89. Re:Cryptic? Complex!? by VGPowerlord · · Score: 2, Informative
    GP quoted the wrong it's.

    And that's nice, but Perl has 10,000+ available modules to do everything from screen-scrape Google news to access Oracle databases (it's greatest strength!!!)
    --
    GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
  90. Re:Arguably one of the greatest? by Goaway · · Score: 1

    My most sincere condolences to you and your fellows in your suffering.

  91. Re:Arguably one of the greatest? by Goaway · · Score: 1

    Now, I agree entirely that being popular is nowhere near reason enough to be called great, and indeed PHP is a festering boil upon the internet, but I'd also argue that in order to be called "one of the greatest programming languages", a language really needs to be in actual use by a significant number of people.

  92. fixed it for you by scotch · · Score: 1
    "There's a right tool for every job and it's almost never X" for all X.

    Hope that helps.

    --
    XML causes global warming.
    1. Re:fixed it for you by spikedvodka · · Score: 1

      come on

      foreach (X){
          print "There's a right tool for every job and it's almost never $_"
      }

      --
      I will not give in to the terrorists. I will not become fearful.
  93. Re:Arguably one of the greatest? by newt0311 · · Score: 1

    suffering? emacs is an awesome piece of software and LISP is a great language to program in. Where is the suffering?

  94. Re:oh come on, you're not even trying now by Anonymous Coward · · Score: 0
    Whoa. Back the truck up. You said:

    Maintaining consistency is up to the developer himself. Obviously, those tempted to succumb to the lure of sloppiness (which, unfortunately, in my experience, is every perl programmer I've ever met including myself) shouldn't use perl for really big projects. You can't blame the language for giving you that freedom, though.
    Um... That's some interesting logic there. Let's try the same logic for heroin:

    Maintaining non-addiction is up to the developer himself. Obviously, those tempted to succumb to the lure of addiction (which, unfortunately, in my experience, is every heroin user I've ever met including myself) shouldn't use heroin. You can't blame hereoin for giving you that freedom, though.
    Now the test question: What's wrong with your use of the word "freedom", given the anecdotal evidence you've presented? And, if it fucks everyone then why can't you blame the language? Could you blame a lighter that didn't require a deliberate action to ignite (just the press of a small protruding button) if it routinely started burning in your and all your friends' pockets? I don't see why we shouldn't blame such a lighter, or a microwave that didn't turn off when you opened it, or ...

    Obviously a ridiculous position. Basically the only way I can make sense of your paragraph is to assume you're holding onto the hope that "everyone you've ever met including yourself" isn't a representative sample. Seriously, WTF.
  95. Re:Cryptic? Complex!? by oscartheduck · · Score: 1

    The standard solution is to not use tabs, which I agree is a pain in the arse in some ways and at best a hacky way of solving the problem, but it seems to work just fine. It's even in the official python best practices that tabs are a no no.

    --
    How to use coral cache: http://slashdot.org.nyud.net:8090/~oscartheduck
  96. Re:Cryptic? Complex!? by seanadams.com · · Score: 1

    That code really is indecipherable. Here is something a little more straightforward:

    #!/usr/bin/perl

    $_='A=15; B=30; select(stdin); $|=1; select(stdout);$|=1; system
    "stty -echo -icanon eol \001"; for C(split(/\s/,"010.010.010.010
    77.77 022.020.020 330.030.030 440.044.000 055.550.000 666.060.".
    "000")){D=0;for E(split(/\./,C)){F=0;for G(split("",E)){C[P][F++
    ][D]=G} D++}J[P]=F; I[P++] =D}%L=split(/ /,"m _".chr(72)." c 2".
    chr(74)." a _m");sub a{for K(split(/ /,shift)){(K,L)=split(/=/,K
    );K=L{K};K=~s/_/L/; printf "%c[K",27}}sub u{a("a=40");for D(0..B
    -1){for F(0..A-1){M=G[F][D];if(R[F][D]!=M) {R[F][D]=M;a("m"."=".
    (5+D).";".(F*2+5)); a("a=".(40+M).";" .(30+M));print " "x2}}}a(
    "m=0;0 a=37;40")}sub r{(N)=@_;while(N--) {Q=W;W=O=H;H=Q;for F( 0
    ..Q-1){for D(0..O-1) {Q[F][D]=K[F][D]}}for F(0..O-1){for D(0..Q-
    1){K[F][D]= Q[Q-D-1][F]}}}}sub l{for F(0..W-1){for D(0..H-1){(K[
    F][D]&& ((G[X+F][Y+D])|| (X+F<0)||(X+F>=A)|| (Y+D>=B)))&& return
    0}}1}sub p{for F(0..W-1){for D(0..H-1){(K[F][D]>0)&&(G[X+F][Y+D]
    =K[F][D]) }}1}sub o{for F(0..W-1){for D(0..H-1){(K[F][D]>0)&&(G[
    X+F][ Y+D]=0)}}}sub n{C=int(rand(P)) ;W=J[C];H=I[C];X=int(A/2)-1
    ;Y=0;for F(0..W-1){for D(0..H-1){K[F][D]= C[C][F][D]}}r(int(rand
    (4)));l&&p}sub c{d:for(D=B;D>=0;D--){for F(0..A-1){G[F][D]||next
    d}for(D2=D;D2>=0; D2--){for F(0..A-1){G[F][D2]= (D2>1)?G[F][D2-1
    ]:0; }}u;}}a ("m=0;0 a=0;37;40 c");print "\n\n".4x" "." "x(A-4).
    "perltris\n".(" "x4)."--"xA."\n".((" "x3)."|"." "x(A*2)."|\n")xB
    .(" "x4). "--"xA."\n";n;for(;;) {u;R=chr(1); (S,T)=select(R,U,V,
    0.01);if(S) {Z=getc;}else {if($e++>20){Z=" ";$e=0;}else{next;} }
    if(Z eq "k"){o;r(1);l||r(3);p}; if(Z eq "j"){o;X--;l||X++;p}; if
    (Z eq "l"){o;X++;l||X--;p};if(Z eq " "){o;Y++;(E=l)||Y--;p;E|| c
    |c|c|c|c|n||goto g;};if(Z eq "q"){last;}}g: a("a=0 m=".(B+8).";0
    " ); system "stty sane"; '; s/([A-Z])/\$$1/g; s/\%\$/\%/g; eval;

  97. Re:oh come on, you're not even trying now by David+Greene · · Score: 1

    Keep It Simple, Stupid (vs PERL's TIMTWWTDI)

    Amen! It's amazing to me the number of people who don't understand this. TIMTOWTDI is the worst aspect of Perl. Well, maybe not the very worst. I'd give that to the OO extensions (and I'm a long-time C++ fan).

    TIMTOWTDI pretty much guarantees that no one else will be able to understand your code. It's great for being "clever" and for stroking your ego by impressing your friends with your one-liners, but that won't fly in software that has to be maintained.

    Perl is fantastic for what it was originally intended to do: process text. Perl's use of regular expressions is right on. Perl was never meant to be used as a database, for large applications or anything beyond quick & dirty tools.

    I use Perl a lot to process reports and create tables for spreadsheets and graphing programs. It works great for that kind of thing. But I would never use it in a large and complex project.

    --

  98. Re:Cryptic? Complex!? by Jason+Earl · · Score: 1

    Yes, when writing python tabs are officially evil. However, if you are using a text editor that can't be taught to replace tabs with the correct number of spaces, then I would suggest that you look into using something other than notepad.exe to code in. Seriously, I can't think of a single software project of any size (in any language) that doesn't have coding standards designed to regulate the use of whitespace. With Python the language itself takes care of the biggest issue when it comes to code formatting. In return you simply have to give up the use of tabs. Fortunately, any modern Python editing environment can be taught to "do the right thing."

    I recently inherited a project (written in Perl) where the person that wrote the original code didn't believe in indenting (I only wish I was kidding). As far as I am concerned white space is definitely significant.

  99. Re:Cryptic? Complex!? by SineWave · · Score: 1
    As a result of the over-flexibility, people have tried to impose "standards" on Perl. There are "standard" techniques for named parameters, "standard" techniques for accessor functions, etc. And that's nice, but Perl has 10,000+ available modules to do everything from screen-scrape Google news to access Oracle databases (it's greatest strength!!!). And not all those modules use the standard techniques.

    Strange, because I only know of one way to supply named parameters to a call, an anonymous hash. OK, to be fair, there may be more, but none of them are reasonable, and as such, that's really the only employed method you see with CPAN^H^H^H^H those 10,000+ modules.

    As for object syntax, your example of

    sub new() {
    my ($class) = @_;
    my $self = {}
    return bless $self, $class
    }

    is a little silly. Almost perfect (IMHO), but the first line makes it so (where's the my $class = shift;? By definition, the first argument to a call of Foo->new() is the class. Yes, it's Perl so there's More Than One Way To Do It(TM), but if someone can't write code that is reasonably congruent with the definitions set forth by said language, by all means, don't blame the language. Going back to the named parameter passing qualm you had, I'm sure I could certainly say the same thing about C by insisting that in my code, all parameters would be passed via a two-dimensional array, with a pointer to the parameter in the first dimension, and the value in the second; but that would just be silly, and everyone would laugh at the code (and not use it) when I posted it to CCAN ;-P

  100. Re:Cryptic? Complex!? by Breakfast+Pants · · Score: 1

    You also have to jump through hoops to just copy and paste the body of a function, or to copy a method of a class and paste it into the interpreter as a function. All the leading indentation screws it up. (yes I know about block select, but it isn't everywhere (like say the web, and no, I'm not going to load some crazy extension just for that)

    --

    --

    WHO ATE MY BREAKFAST PANTS?
  101. Re:Cryptic? Complex!? by cant_get_a_good_nick · · Score: 1

    > What do you dislike about it?
    My biggest issue is that i can take a perfectly working piece of code and open and save in my text editor, and depending on if my editor handles tab/hard tab differently than yours does, break working code. From the many people at my work who use python and love it, this seems more theoretical than actually encountered in practice, but is a real risk.

  102. Re:Cryptic? Complex!? by swillden · · Score: 1

    1) You can't put more than 1 statement on the same line as an 'if' or 'else'. "if (increment_them) {a++; b++;}" won't fly. Some people might think that's good, I think it's limiting.

    I think it's irrelevant. I do that sometimes, but I've never seen a situation where I felt it was crucial for clarity. It provides a bit of vertical whitespace compresssion, that's all.

    2) Mixing spaces and tabs for indentation is a MAJOR no-no. If my text editor has tabsize 4, and somebody used 4 spaces to indent one block, if I try and indent the next block down with 2 tabs (8 spaces on my text editor), what does Python do? Someone else's text editor might display tabs as 2 spaces. Sure, you can try and mandate that everyone use tabs or spaces for indentation, but it's just a potential headache that wouldn't be there if Python weren't so stupid.

    In theory, that's a problem. In practice, it doesn't seem to cause any trouble. Perhaps that's because most people use Python-aware editors that either don't mix tabs and spaces, or do it consistently so that there is no possibility for ambiguity? I'm not sure why it isn't a problem, but it doesn't seem to be a real issue. What I do know is that this complaint is common among programmers who haven't written much Python, but those who have actually used the language a significant amount shrug it off as not a real issue.

    I think it's similar to the people who insist that C/C++/Java conditional or looping statements that have a single-statement block should always have open/close braces, even though they're unnecessary. They argue that it's obvious that without the braces some programmer will come along later and add statements to the "block" without adding the needed braces.

    In practice, I've been writing single-statement "blocks" without braces for nearly 20 years now, and always allowed my teams to do the same, and I've only seen the problem a bare handful of times -- far too few to be worth the effort of all those extra braces.

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  103. Re:Cryptic? Complex!? by swillden · · Score: 1

    From the many people at my work who use python and love it, this seems more theoretical than actually encountered in practice, but is a real risk.

    I suspect the reason it doesn't happen much is because people use Python-aware text editors that keep the tab/space mix sane (which usually means "don't mix them"). Whatever the reason, it does seem to be a theoretical risk rather than one that actually causes problems. That being the case, is it really a reason to avoid Python?

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  104. Re:Cryptic? Complex!? by MoxFulder · · Score: 1

    Strange, because I only know of one way to supply named parameters to a call, an anonymous hash. OK, to be fair, there may be more, but none of them are reasonable, and as such, that's really the only employed method you see with CPAN^H^H^H^H those 10,000+ modules.

    I seem to recall that CGI.pm uses argument lists where positional and named parameters can be arbitrarily mixed, but the positional params always start with a dash. It's nice... but it's naturally Slightly Different From Every Other Way To Do It.
  105. Re:Cryptic? Complex!? by crucini · · Score: 1

    It's completely obvious what's going on just by reading the code.

    Really? Care to apply that concept to this or this?
  106. Re:oh come on, you're not even trying now by fireboy1919 · · Score: 1

    Read better. I qualified the point where perl is useful. I'll elaborate anyway.
    Unlike heroin and a defective lighter, perl is useful to me and to other developers for throw away code (i.e. stuff you're only going to use once), for small projects, and for heavily QAed coding.

    Any of these approaches do a good job of guaranteeing that you won't have any problems with sloppiness.
    I would go so far as to saying that in the first two cases - small projects and throw away code are both very good places to use perl. You get your results much faster than if you have to fit things into another language.

    Perl makes a very good shell language. It's also good as a configuration language and a text transformation language, specifically because all of these jobs are small and often throw-away.
    These are just a few things that I can think of off of the top of my head.

    --
    Mod me down and I will become more powerful than you can possibly imagine!
  107. Re:Cryptic? Complex!? by slittle · · Score: 2, Informative

    You can't put more than 1 statement on the same line as an 'if' or 'else'. "if (increment_them) {a++; b++;}" won't fly.
    You can (but generally shouldn't).

    >>> if True: a = 0; b = 1; c = 2; print a, b, c
    0 1 2
    >>>

    --
    Opportunity knocks. Karma hunts you down.
  108. Re:Cryptic? Complex!? by clayne · · Score: 0, Offtopic

    Yes - because everyone normally writes production C code as an obfuscation contest?

    Lame example. If anything perl heads much more in that direction with less effort than C does.

  109. Re:Cryptic? Complex!? by crucini · · Score: 1
    Your original claim was:

    It's completely obvious what's going on just by reading the code.

    You did not restrict that claim to production code.

    How does the obviousness of production code differ between C and Perl?
  110. Re:oh come on, you're not even trying now by hotfireball · · Score: 1

    >In perl, you can change the nature of the language itself. *Everything* can be changed.

    This means, that existing condition can not satisfy. But we all waiting for that changes: Parrot with Perl 6. While it is in "hard progress", we use Python.

  111. Re:oh come on, you're not even trying now by hotfireball · · Score: 1

    > Perl's "TMTWWTDI" actually DOES keep it simple.

    Oh well...

    I'd like to see how "simple" you will work with a structures, kind
    of "hash of hashes of arrays of arrays of hashes" and then compare
    two or more structures for differences. I also want to see the code
    and perfomance how it works. :-)

    In Python I do simply: if a == b: (it's that simple, huh?) and it *is*
    comparable as it is, but what to do in Perl?..

    If I need very complex structures, I just simply build a class,
    define __cmp__ method and it is. For example:

    >>> class A:
    ...   x = None
    ...   def __cmp__(self, i):
    ...      return self.x == i
    ...
    >>> a = A()
    >>> b = A()
    >>> a == b
    True
    >>> a.x = 1
    >>> b.x = 2
    >>> a == b
    False

    Any examples to make this in Perl as simple as it is?

    * * *

    BTW, how to catch exceptions in Perl? How to catch custom exceptions?
    I don't need "to die" in my script, but just skip an error, spitting on STDERR
    the result of an exception.

    Any help from Perl guru?

    P.S. To make Perl source code smaller: use gzip. Readability will not suffer...

  112. Re:Cryptic? Complex!? by clayne · · Score: 0

    You're strawmaning this into stupidity territory now.

    It is implied that it's production code not toy obfuscated code. There's no reason to play stupid about that.
    Now reanalyze your last statement and consider it's circularity.

  113. Re:Cryptic? Complex!? by itsdapead · · Score: 1

    If only Python didn't require the use of whitespace for defining blocks. It is indeed tragic that an otherwise fine language is so goddamn retarded in that one aspect.

    Count me in with the people who tossed the Python book out of the window as soon as I read that line.

    Years ago, there was an old-chestnut "funny" doing the rounds about how Thompson & Richie made up the UNIX operating system as a joke - one of the bits of "evidence" there was that makefiles used whitespaces to deliniate blocks. Hmm.

    Trouble is, anybody who has used the broad C/Java genre of languages (of which even Perl is a peripheral member) - or HTML/XML for that matter - is used to mentally "collapsing" any combination of spaces, newlines and tabs. Heck, using spaces for indentation is even bad practice in a wordprocessor.

    I can see that a nicely indented Python program would be perfectly readable provided you always edited it in the same text editor, preferably a nice language-aware IDE, with the same tab and indentation settings. Then you change IDEs, or make a quick "in the field" patch in a different editor, set to use hard tabs or with the "indent" setting different from the "tab" setting and you've suddenly broken the code. I'm sure many people have wasted ages faffing about with indentation styles to pretty up their code - now imagine you had to do that to get the program to run!

    --
    In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
  114. Re:Cryptic? Complex!? by TeknoHog · · Score: 2, Interesting

    But once I actually tried to write a program in Python, I found I didn't mind it one bit. Within a few hours my eyes didn't get confused by the lack of braces. I think it's actually easier on the eyes once you get used to it.

    Python was one of my first programming languages, and the whitespace thing made sense to me from the beginning. In most C-style code, people use both braces and indentation to denote blocks; isn't that redundant? It seems braces are for the compiler and indentation is for human readers. Shouldn't higher level languages be designed for humans rather than machines?

    --
    Escher was the first MC and Giger invented the HR department.
  115. Re:Cryptic? Complex!? by dcam · · Score: 1

    Indeed. I wrote an article about some of the issues with perl. link

    --
    meh
  116. Stop beating the dead horse by Anonymous Coward · · Score: 0

    Let perl rest in peace. We've had more modern evolutionary solutions for years now. Go to http://www.ruby-lang.org/ for more information

  117. Re:oh come on, you're not even trying now by dcam · · Score: 1

    You can't blame the language for giving you that freedom, though.

    Rubbish. Perl is completely to blame for giving you the freedom. The programmers are to blame for what you do with that freedom, but perl is to blame for creating the freedom. Perl is bears significant responsibility for a lot of hideous code.

    --
    meh
  118. Re:Cryptic? Complex!? by Dan+Ost · · Score: 1

    I can't comment on how mature Ruby is, but I do remember it having some of the same Perl-like attributes that made me search for a Perl replacement in the first place.

    --

    *sigh* back to work...
  119. Another name for Minimal Perl... by daves · · Score: 1

    ... is Perl 4. Object Oriented structures did not go easily into the language.

    --
    People who disagree with you are not automatically evil, greedy, or stupid.
  120. MOD PARENT UP by Anonymous Coward · · Score: 0

    GP asked if Perl was more confusing that other languages. Parent gave a concrete example and was modded troll. WTF? He was even nice about it!

  121. Re:oh come on, you're not even trying now by Looke · · Score: 1

    It sounds like you're talking about Lisp, not the Perl I know, with all that changing everything talk. I still haven't seen how to programmatically modify Perl code, extend Perl's syntax, etc., but to a Lisper, that's all daily routine. Molding the language to fit your purpose is very good Lisp advice.

  122. Re:oh come on, you're not even trying now by Anonymous Coward · · Score: 0

    "Perl is fantastic for what it was originally intended to do: process text. Perl's use of regular expressions is right on. Perl was never meant to be used as a database, for large applications or anything beyond quick & dirty tools.

    I use Perl a lot to process reports and create tables for spreadsheets and graphing programs. It works great for that kind of thing. But I would never use it in a large and complex project."

    Right... *sigh*

    I keep on hearing about people who would never use it for large and complex projects - that's probably because they've never worked on large and complex projects in any language.

    Large and complex projects incurr complexity by their nature, that means regardless of the language you need to :
    * carefully model the problem domain
    * ensure that the code communicates what it is doing (IME Perl is far easier to read than C#, C, C++ and Java, and certainly as easy to read if you know Perl, as Python is if you know Python)
    * ensure that API's are consistent and clear
    * ensure that the software is composed in a way that allows unit and regression testing
    * ensure that developer and user documentation matches behaviour and the tests.
    * scales vertically and horizontally
    * manage version control, requirement changes, etc

    That's a lot of work, but I don't see how Perl makes any of that hard - in fact, Perl's standards of packaging, inline documentation, and unit testing helps a great deal, as does the abundance of high quality CPAN modules and reference material (both online and dead trees), and Perl's very experienced community, that provides proven and scalable software solutions like memcached and mod_perl, as well as battle-proven advice and wisdom.

    Aaron Trevena

  123. Re:Cryptic? Complex!? by Hatta · · Score: 1

    And that's nice, but Perl has 10,000+ available modules to do everything from screen-scrape Google news to access Oracle databases

    About a year ago I decided to give Python a try. And I haven't looked back. It can do everything Perl can do, and then some.

    Python has more modules than perl? I use perl for the same reason I use debian. No matter what I want to do there's already a package to do it. It's the availablity of apps that makes an OS, and it's the availability of modules that makes a programming language. I have nothing against python, but until I can reasonably expect that there is a python module available for any given task I'll stick with perl.

    --
    Give me Classic Slashdot or give me death!
  124. Re:Cryptic? Complex!? by admdrew · · Score: 2, Insightful

    Well most languages have these things called functions, you can use them to do your own string functions.

    Yay! Let's reinvent the wheel by writing 10, 20, or more lines of code for something regular expressions would be able to handle in one. Furthermore, let's claim this is done for the sake of keeping the code 'pretty,' because it's far too embarrassing to admit that we don't really understand how to use regular expressions!

    Other Languages have a bunch of well performing string functions so I don't need to program them myself.

    Hmm, like string functions that allow the use of regular expressions to make your string manipulation quick, efficient, and useful?

    Yes, regex can be an odd concept to deal with at first, as they tend to be quite a bit more succinct than the languages you're more familiar with. Are you aware, however, that regular expressions can contain comments and extra whitespace?

    Maybe you're paid by the line of code, or am attempting to squeeze in every extraneous hour of programming to inflate your consultant fee. If that's the case, I would certainly recommend avoiding regular expressions; they save far too much time and work entirely too well.

  125. Re:oh come on, you're not even trying now by Anonymous Coward · · Score: 0

    TIMTOWTDI is the worst aspect of Perl. Well, maybe not the very worst. I'd give that to the OO extensions (and I'm a long-time C++ fan).
    Larry Wall is a linguist - is TIMTOWTDI true of English? Or music? Not to get poncy, but the 'art' of programming can only be extended by pushing the boundaries and finding new ways of doing things. Perl allows you to write (say) 10 lines of C++ that as 10 lines of Perl that looks pretty much the same...or as a single line (thus reducing bugs per LOC :) ) As for the 'OO extensions' - I'm gettting a bit bored of this as a criticism of Perl. It's simply another instance of TIMTOWDI. At heart, an object is simply a reference to a bunch of data and code, so Perl just lets you deal with that in whatever way you want. Again, if you want to write code that looks like Smalltalk, there'll be a CPAN module somewhere :)

    Perl was never meant to be used as a database, for large applications or anything beyond quick & dirty tools.
    Bows and arrows were never meant to be used as a means of war, for mass murder or anything beyond quick & dirty hunting.

    But I would never use it in a large and complex project.
    /me posts this reply to slashdot.org/comments.pl
  126. Re:Cryptic? Complex!? by Augie+De+Blieck+Jr. · · Score: 1

    I'm learning Ruby now, after programming in Perl for a majority of my time in the last 10 years or so. Ruby is very Perl-ish at times, but the OO stuff is a lot cleaner and easier to learn. I'm enjoying it. It's the first OO language I've felt comfortable in.

  127. Dark spot? by Ayanami+Rei · · Score: 1

    Ruby is the next perl. It is now what Perl 6 cannot be.
    Soon, it will be just as fast.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  128. Re:oh come on, you're not even trying now by Lord+Ender · · Score: 1

    It amuses me that any criticism of Perl in this story gets buried to -1 by the mods. Yay discussion.

    --
    A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
  129. Re:Cryptic? Complex!? by MoxFulder · · Score: 1

    Python has more modules than perl?

    I didn't say that! Perl definitely has more modules, CPAN is *huge*. Though Python includes more functionately, in a more polished and coherent form, in its standard library (everything from regular expressions to a complete standards-compliant subclass-able HTTP server with CGI support).

    I use perl for the same reason I use debian. No matter what I want to do there's already a package to do it. It's the availablity of apps that makes an OS, and it's the availability of modules that makes a programming language. I have nothing against python, but until I can reasonably expect that there is a python module available for any given task I'll stick with perl.

    I don't disagree... if I need to do something obscure, there are better chances of finding a Perl module than a Python module. But frankly, I haven't run into more than one or two such cases in nearly a year of using Python heavily now. I've found that when there *are* comparable modules, the Python one is typically easier to build and use (for example the Perl GPIB module vs PyVISA was a recent one, where Perl GPIB was a serious nightmare to get installed on Cygwin, while PyVISA Just Worked).

    The only thing I can think of where I couldn't find a python module, was when I needed to read Intel HEX files (a fairly trivial file format). It only took me a few minutes to write such a thing in Python.
  130. Re:Cryptic? Complex!? by Hatta · · Score: 1

    I'm currently working on a project that uses Gene Ontology data. As far as I know go-perl is the only module available for any language that handles this. Not that that means anything, it's just another example.

    --
    Give me Classic Slashdot or give me death!
  131. Re:Want unicode? Try tcl by Viol8 · · Score: 1

    Sorry , but Tcl is a joke language , always has been. If it hadn't been for Tk it would have disappeared into the Where Are They Now? catagory of forgotten programming languages ages ago. Its syntax is unclear, inflexible and kludgy, the interpreters frequently had memory leaks and were unstable and its slow to boot.

    Tcl is a useful scripting language if you want to knock up a quick GUI app that doesn't really have to do very much very quickly - its useless for anything else.

  132. Re:Cryptic? Complex!? by metamatic · · Score: 1

    Try Ruby.

    Python fans say that the obnoxious whitespace handling of Python is a minor thing to have to put up with, but with Ruby around I don't have to put up with it. Or the ugly __underscores.

    --
    GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  133. Re:Cryptic? Complex!? by Chris+Burke · · Score: 1

    Wow! That does the trick nicely. Thank you very much, that makes things even easier. And who says you'll never learn anything on slashdot?

    Heh, which was exactly why I brought the issue up. I was hoping someone would reply "You fuckin retard [cus this is the internet -ed], all you have to do is use this emacs lisp file blah-blah-blah" and fix it for me. :)

    --

    The enemies of Democracy are
  134. Ruby is slow by bill_mcgonigle · · Score: 1

    I learned Perl back before Ruby was usable.

    I wouldn't bother to learn Perl now.


    I've been watching Ruby for a number of years, and I like it alot. But the current version of the runtime is just too slow for large data processing jobs. Perl is pretty darn fast for what it is.

    The 2.0 line of Ruby looks like it will be usable for these tasks, so I eagerly await it. I think running perl5, perl6, and ruby (hey, python too) on the same runtime will be even better since I can share modules.

    --
    My God, it's Full of Source!
    OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    1. Re:Ruby is slow by metamatic · · Score: 1

      There's always JRuby, if you want C++-like performance.

      YARV is faster than Parrot at running Ruby, according to the most recent benchmarks I've seen.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    2. Re:Ruby is slow by bill_mcgonigle · · Score: 1
      There's always JRuby, if you want C++-like performance.

      Are you sure about that? I saw a benchmark showing JRuby as 2200 times slower than Ruby2 on some tests. From an IBM interview last summer:

      What's next for JRuby?

      Charles: Performance, performance, performance. JRuby is still far slower than we'd like it to be and quite a bit slower than C Ruby. There's no reason that we couldn't match or exceed Ruby 1.8's performance, and with a compiler we should be able to exceed it. There are still compatibility issues to be worked out, but that may always be the case. With so many great apps already starting to work in JRuby, improving performance has become my main priority.
      YARV is faster than Parrot at running Ruby, according to the most recent benchmarks I've seen.

      How baked is YARV at this point? Drop-in replacement?
      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    3. Re:Ruby is slow by metamatic · · Score: 1

      Hmm, I assumed that JRuby would speed up over the long term, like Java in general. Guess not.

      YARV is in the CVS respository. Barring major disaster, I expect it will ship with the next major release. I haven't tried it myself yet, busy writing Java at the moment...

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  135. Re:Cryptic? Complex!? by pilkul · · Score: 1

    The problem with it is not readability, it's peripheral things like the way it interacts poorly with merge/source control tools (many of which are designed to ignore whitespace), and with poorly configured editors (which will sometimes insert hard tabs instead of whitespace and cause an error). I mean, it's not a big deal either way but it does cause a few problems sometimes.

  136. Re:Cryptic? Complex!? by Chris+Burke · · Score: 1

    Python fans say that the obnoxious whitespace handling of Python is a minor thing to have to put up with, but with Ruby around I don't have to put up with it. Or the ugly __underscores.

    If I can get my employer to let me learn Ruby on company time, I'd absolutely love to. Maybe next time a scripting project comes up, I can convince my boss that Python is old and tired, and Ruby is the new hotness. ;)

    What do you mean __ugly __underscores__? Personally I like it, because it's an easy visual clue that the code is dinking with the internal magic of python objects.

    --

    The enemies of Democracy are
  137. corrected examples by bill_mcgonigle · · Score: 1

    Slashcode ate the spaceship operator! I'll try again with HTML entities:

    my @sorted_people = sort { $a{age} <=> $b{age} } @people;

    To understand this you need to know two things: the sort operator takes an optional function, which defines $a and $b as the two objects to compare and that perl has a special operator <=> (the SpaceShip operator) which is a trinary result operator that meshes really nicely with sort.

    --
    My God, it's Full of Source!
    OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
  138. Re:Cryptic? Complex!? by metamatic · · Score: 1

    I meant double underscores on things which *aren't* messing with the magic of internal Python objects. Like __new__ and __init__ and __private_variables.

    --
    GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  139. Re:Cryptic? Complex!? by pclminion · · Score: 1

    I always love this comment. Are you saying you want to be free to code with no indentation if you wish? Go right ahead, but don't do it in Python. At least when I look at a Python program I don't have to worry that I'm being deceived by indentation that makes it LOOK like the code does one thing, and braces that CAUSE it to do something else.

    Haven't you ever heard of the problems of double-dimensioning? In the case of braced, loosely-indented language, the indentation is a pathetic surrogate of the true control operators -- the braces themselves. When these two things get out of sync with each other, the problems can be severe. Similar problems arise when somebody changes a piece of code, but fails to update the comment which explains that code. Somebody looking at this code in the future now has to guess: is the comment wrong, or is the code wrong?

    Python, on the other hand, forces the indentation to match the intended control structure of the program. It removes the conceptual double-dimensioning and makes code much easier to read.

    So really it must come down to laziness on your part. You don't WANT to get the indentation right. This is a ridiculous gripe in a world with a zillion programming editors which will handle the indentation for you.

    Maybe if you are forced to indent properly you'll find yourself spending less time lost in your own control flows.

  140. See MinimalPerl.com for more on this book by yumpy · · Score: 1
    http://minimalperl.com/ provides access to a variety of materials related to the Minimal Perl book:
    • links to free chapter downloads
    • links to reviews of the book
    • downloads of free software
    • interviews with the author
    • slides of related conference presentations
    • and more!
    --
    - Tim Maher, TeachMePerl.com & MinimalPerl.com
  141. Re:Want unicode? Try tcl by Rick+BigNail · · Score: 1

    Agree.

    Lua and javascript rules!

  142. Re:Cryptic? Complex!? by chromatic · · Score: 1

    I use vertical whitespace to delineate more than just blocks. Unfortunately, Python offers no visual way to distinguish between my various uses of vertical whitespace.

  143. Re:Cryptic? Complex!? by Chris+Burke · · Score: 1

    Okay, I haven't used private variables enough to care, but the __init__ stuff falls into the same category for me as 'internal magic'. __init__ is a special function that gets called automatically. Writing your own __init__ or __new__ or __str__ has meaning in other contexts that you need to be aware of. The underscores, well, underscore this special behavior.

    Double leading and trailing underscores is a bit excessive though.

    --

    The enemies of Democracy are
  144. Not by novice by renoX · · Score: 1

    "But Perl has a reputation for taking an excessive cryptic nature which gives it an image especially among Perl novices as a language which is complex and hard to master"

    Mmm, the bad Perl reputation is not especially among novices: at my beginning in Perl, I thought that it was a better, more powerful shell, and then I discovered Perl's maintenance hell and the more I used Perl, the more I disliked it.

    Thank God for Ruby, it's funny it occupies exactly the same niche than Perl, but it's so different.. Ruby's creator has a 'really good aesthetic sense' and now that (at last) RoR is helping the Ruby language to spread, it has a chance to be used more often.

  145. Re:Cryptic? Complex!? by MoxFulder · · Score: 1

    This is utterly juvenile...

    But the biggest thing that turns me off from Ruby is the fact that the "print string" command is called "puts". It's also a Yiddish slang term for "penis", "idiot", or "fooling around".

    Somehow I just can't take Ruby code seriously :-P

  146. Re:Cryptic? Complex!? by metamatic · · Score: 1

    Writing initialization and allocation methods is a standard part of OO programming. It's not special internal magic.

    --
    GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  147. Eugh! Spaguetti code... by jotaeleemeese · · Score: 1

    if (increment_them) {a++; b++;}

    anything that prevent such abominations is a good thing.

    --
    IANAL but write like a drunk one.
  148. I know UNIX, could not care less about perl by jotaeleemeese · · Score: 1

    Because perl is not UNIX.

    UNIX came first, perl was added later.

    As an experienced System Administrator I still have to find a task that *requires* perl.

    --
    IANAL but write like a drunk one.
  149. In theory yes. In practice no. by jotaeleemeese · · Score: 1

    Perl is bent on been unreadable.

    You want to do a quick and dirty script to solve some small problem, perl will do, but then revisit the same script some time later and I am telling you, you will not know what you were thinking or why did you use a certain perl idiom that may have seen brilliant while coding in a hurry.

    Perl has its place. Somewhere. I don't know where, but somewhere.

    But in scripting there are many options that keep things simpler. Very often using the traditional UNIX pipes clarifies immensily a problem (because you have to digest the different parts of it) while perl my cloudy it in an unmantainable brilliant code snippet.

    --
    IANAL but write like a drunk one.
    1. Re:In theory yes. In practice no. by chromatic · · Score: 1

      You want to do a quick and dirty script to solve some small problem, perl will do, but then revisit the same script some time later and I am telling you, you will not know what you were thinking or why did you use a certain perl idiom that may have seen brilliant while coding in a hurry.

      Funny, I don't have that problem. Then again, I factor my code into manageable parts, use good identifier names, use well-tested code whenever possible, and code for maintainability, just as I would when using any other language.

      Of course if you write bad code it'll be difficult to maintain! That's what happens when you write bad code.

  150. Re:Cryptic? Complex!? by Chris+Burke · · Score: 1

    Not exactly, but they -are- functions that are handled specially, rather than functions that are only called directly at the programmer's behest (or through a function reference explicitly initialized by the programmer). Constructors and allocators have special syntax in the C++ and Java; having them be identified as 'different' in python makes sense as well. You rarely explicitly call someobject.__init__() because it is called automatically. Ergo special syntax. It's consistant and it works and I like it.

    --

    The enemies of Democracy are
  151. Re:Cryptic? Complex!? by Anonymous Coward · · Score: 0

    My first experience with Python was being asked to debug someone else's code and finding a dangling if. I thought "How could such a recent language allow this?" It took me way to look to find the answer via Google. Not a big deal, but gave me a bad first impression.

  152. Re:Want unicode? Try tcl by sigzero · · Score: 0

    You obviously do not know what you are talking about. Tcl is one of the most flexible languages out there. The incorrect facts you are spewing tell me that you haven't even looked at it in years. The 8.X series is fast and stable. The code for Tcl itself gets praises from anyone who has ever looked at it. Tcl 8.5 is going to have an OO core so that the current OO frameworks (Snit, XOTcl, etc.) have even better access to the Tcl internals. Tk itself is going through a revision that will add native look and feel to Tk anywhere Tk runs. i18n? Tcl has it and has it right. Threads? Tcl has had them and has them right. You can use Tcl for *anything* that you use the other dynamic languages for period. Does Tcl have its own warts? Yes, but so do all the others. I have to say also that the Tcl community is the most friendly of ALL the major ones I have watched and/or been involved with.

    You are in the same league as those who spew the same crap against Perl thinking Perl is still in its 4.X days.

    So please, pull your head out of the past.

  153. Re:oh come on, you're not even trying now by sigzero · · Score: 0

    Perl has the DBI...it is awesome. Perl has the CPAN...it is awesome. Perl has great web frameworks at all levels. When I need to get stuff done I fall back to Perl because Python and Ruby just don't have it. Want to pull data out of a DB and put it into an Excel spreadsheet? Spreadsheet::WriteExcel + DBI + DB rocks! The other languages languish on stuff like this but CPAN is monstrously useful. If you are arguing Perl is hard to read it is because of the PROGRAMMER and not the language and most people are only arguing over what they remember about Perl 4.X which is YEARS old. Perl 5.6+ is awesome. The only thing I don't like about Perl is its OO system. That is crap but workable.

  154. Re:Cryptic? Complex!? by Anonymous Coward · · Score: 0

    By definition, the first argument to a call of Foo->new() is the class.

    Yes, and his code picks out the first argument. WTF is wrong with that?
  155. Re:Cryptic? Complex!? by metamatic · · Score: 1

    Well, constructors and allocators don't have special syntax in Ruby, and I haven't heard anyone suggest that it's a problem...

    --
    GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  156. Re:Cryptic? Complex!? by Anonymous Coward · · Score: 0

    "putz" not "puts" you "schmuck".

  157. Re:Cryptic? Complex!? by Chris+Burke · · Score: 1

    Who said anything about problems? It's just consistant and i don't mind consistancy. But do you mean that in Ruby constructors aren't called automagically and are handled explicitly by the programmer? That'd be a difference. Otherwise, C++ doesn't have particularly special syntax for constructors and it isn't a "problem", but neither would it be a problem if they did.

    --

    The enemies of Democracy are
  158. Re:Cryptic? Complex!? by metamatic · · Score: 1

    No, I mean that in Ruby, constructors don't have special syntax and aren't covered in underscores or other ugly punctuation.

    --
    GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak