Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Minimal Perl for Unix and Linux People

Posted by samzenpus on Wed Feb 21, 2007 03:37 PM
from the easy-does-it dept.
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.
This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • by mobby_6kl (668092) on Wednesday February 21 2007, @03:40PM (#18100588)
    Minimal Perl for Unix and Linux People? Is this the result of a perlgolf competition between perl-related books?
  • *sigh* (Score:5, Funny)

    by A beautiful mind (821714) on Wednesday February 21 2007, @03:41PM (#18100606)

    Perl (Practical Extraction and Report Language)
    That's a backronym. By those standards you could also call PHP Pretty Hellish Performance.
  • by NaCh0 (6124) on Wednesday February 21 2007, @03:44PM (#18100654)
    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.
    • Re:So you like the book (Score:5, Funny)

      by realmolo (574068) on Wednesday February 21 2007, @03:59PM (#18100864)
      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
       
      [ Parent ]
  • Cryptic? Complex!? (Score:5, Funny)

    by setirw (854029) on Wednesday February 21 2007, @03:51PM (#18100758)
    (http://www.badgerville.org/)

    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!")
    • Re:Cryptic? Complex!? by MindStalker (Score:1) Wednesday February 21 2007, @04:00PM
    • Re:Cryptic? Complex!? (Score:5, Interesting)

      by MoxFulder (159829) on Wednesday February 21 2007, @04:13PM (#18101050)
      (http://www.toleressea.net/)

      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.
      [ Parent ]
      • Re:Cryptic? Complex!? by Ikoma Andy (Score:3) Wednesday February 21 2007, @04:38PM
      • Re:Cryptic? Complex!? (Score:5, Informative)

        by massysett (910130) on Wednesday February 21 2007, @04:50PM (#18101608)
        (http://www.smileystation.com/)
        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...
        [ Parent ]
      • Re:Cryptic? Complex!? by Scarblac (Score:3) Wednesday February 21 2007, @04:56PM
        • by doom (14564) <doom@kzsu.stanford.edu> on Wednesday February 21 2007, @05:34PM (#18102180)
          (http://obsidianrook.com/ | Last Journal: Tuesday October 16, @01:48AM)

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

          [ Parent ]
        • Re:Cryptic? Complex!? by MoxFulder (Score:3) Wednesday February 21 2007, @07:13PM
      • Re:Cryptic? Complex!? (Score:4, Insightful)

        by jez9999 (618189) on Wednesday February 21 2007, @05:48PM (#18102304)
        (http://www.game-point.net/ | Last Journal: Monday November 14 2005, @09:19AM)
        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.
        [ Parent ]
        • Re:Cryptic? Complex!? by swillden (Score:2) Wednesday February 21 2007, @06:55PM
        • Re:Cryptic? Complex!? (Score:4, Insightful)

          by MoxFulder (159829) on Wednesday February 21 2007, @07:31PM (#18103438)
          (http://www.toleressea.net/)

          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.
          [ Parent ]
        • Re:Cryptic? Complex!? by itsdapead (Score:2) Thursday February 22 2007, @05:41AM
        • Re:Cryptic? Complex!? by pclminion (Score:2) Thursday February 22 2007, @01:13PM
        • 1 reply beneath your current threshold.
      • Re:Cryptic? Complex!? by Chris Burke (Score:2) Wednesday February 21 2007, @06:11PM
      • Re:Cryptic? Complex!? by SineWave (Score:1) Thursday February 22 2007, @12:03AM
      • Re:Cryptic? Complex!? by dcam (Score:2) Thursday February 22 2007, @06:25AM
      • Re:Cryptic? Complex!? by Hatta (Score:2) Thursday February 22 2007, @09:55AM
      • 1 reply beneath your current threshold.
    • It gets worse... by mkcmkc (Score:2) Wednesday February 21 2007, @04:48PM
    • Re:Cryptic? Complex!? by seanadams.com (Score:2) Wednesday February 21 2007, @10:59PM
  • I {} Perl (Score:5, Interesting)

    by Cally (10873) on Wednesday February 21 2007, @03:53PM (#18100788)
    (http://www.vanitydomainsarelikeso20thcentury.org/)
    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...

    • Re:I {} Perl (Score:5, Funny)

      by timster (32400) on Wednesday February 21 2007, @04:10PM (#18101006)
      "Speak" Perl, right. Because what Unix really needed was a combination of the specificity of natural language and the friendly syntax of awk.
      [ Parent ]
    • Re:I {} Perl by Phroggy (Score:2) Wednesday February 21 2007, @04:55PM
      • Re:I {} Perl by Cally (Score:2) Wednesday February 21 2007, @05:26PM
        • Re:I {} Perl by Phroggy (Score:2) Thursday February 22 2007, @12:09AM
          • Re:I {} Perl by Cally (Score:2) Thursday February 22 2007, @04:20PM
            • Re:I {} Perl by Phroggy (Score:2) Friday February 23 2007, @01:12PM
    • Re:I {} Perl by jsdcnet (Score:1) Wednesday February 21 2007, @08:36PM
    • Re:I {} Perl by Eivind Eklund (Score:2) Thursday February 22 2007, @03:03AM
    • Re:I {} Perl by mbrod (Score:2) Thursday February 22 2007, @10:14AM
    • I know UNIX, could not care less about perl by jotaeleemeese (Score:2) Friday February 23 2007, @11:26AM
    • 1 reply beneath your current threshold.
  • the book looks very relevant (Score:2, Interesting)

    by keshto (553762) on Wednesday February 21 2007, @03:57PM (#18100816)
    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.
  • by RiotXIX (230569) on Wednesday February 21 2007, @03:58PM (#18100840)
    (Last Journal: Saturday October 15 2005, @06:40PM)
    Useful review.

    I'm currently going through http://www.oreilly.com/catalog/sed2/ [oreilly.com], 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.
  • That's cheating (Score:2)

    by Daishiman (698845) on Wednesday February 21 2007, @04:00PM (#18100866)
    It's not considered one line if it has 3398EAFF23 characters.
  • by andy314159pi (787550) on Wednesday February 21 2007, @04:00PM (#18100868)
    (Last Journal: Thursday June 07, @02:55PM)
    #!/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
  • by TheRealMindChild (743925) on Wednesday February 21 2007, @04:00PM (#18100872)
    (http://www.mindchild.net/ | Last Journal: Tuesday November 29 2005, @10:16AM)
    10 CurrentFile = Dir("*.pl") 20 Do while len(CurrentFile) > 0 30 Kill CurrentFile 40 CurrentFile = Dir() 50 Loop 60 End
  • Why not for Windows people? (Score:5, Interesting)

    by rrohbeck (944847) on Wednesday February 21 2007, @04:12PM (#18101034)
    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.

  • Cryptic? (Score:4, Insightful)

    by locokamil (850008) on Wednesday February 21 2007, @04:14PM (#18101072)
    (http://www.anserinae.net/)
    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. ..
    • Re:Cryptic? (Score:4, Informative)

      by drinkypoo (153816) <martin.espinoza@gmail.com> on Wednesday February 21 2007, @04:21PM (#18101174)
      (http://www.hyperlogos.org/ | Last Journal: Wednesday July 18, @08:19PM)

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

      [ Parent ]
      • Re:Cryptic? by runningduck (Score:1) Thursday February 22 2007, @12:47AM
      • Re:Cryptic? by dcam (Score:2) Thursday February 22 2007, @07:03AM
    • Re:Cryptic? by abigor (Score:2) Wednesday February 21 2007, @04:38PM
      • Cryptic whitespace (Score:4, Insightful)

        by myowntrueself (607117) on Wednesday February 21 2007, @04:53PM (#18101652)
        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?
        [ Parent ]
      • Re:Cryptic? by chromatic (Score:1) Wednesday February 21 2007, @06:10PM
    • Re:Cryptic? by Prof.Phreak (Score:3) Wednesday February 21 2007, @04:50PM
    • Re:Cryptic? by qwijibo (Score:2) Wednesday February 21 2007, @05:00PM
    • Re:Cryptic? by zero1101 (Score:2) Wednesday February 21 2007, @05:09PM
      • Re:Cryptic? by locokamil (Score:2) Wednesday February 21 2007, @05:12PM
        • Re:Cryptic? by zero1101 (Score:2) Wednesday February 21 2007, @07:45PM
    • Re:Cryptic? by rrohbeck (Score:2) Wednesday February 21 2007, @06:12PM
      • Re:Cryptic? by daveclearyinmd (Score:1) Wednesday February 21 2007, @07:51PM
    • Re:Cryptic? by swordgeek (Score:2) Wednesday February 21 2007, @08:21PM
    • Re:Cryptic? by element-o.p. (Score:2) Wednesday February 21 2007, @09:09PM
    • Re:Cryptic? by Just Some Guy (Score:1) Wednesday February 21 2007, @09:13PM
      • Re:Cryptic? by chromatic (Score:1) Wednesday February 21 2007, @10:02PM
        • Re:Cryptic? by Just Some Guy (Score:2) Wednesday February 21 2007, @11:22PM
          • Re:Cryptic? by publius_ovidius (Score:2) Thursday February 22 2007, @07:03AM
      • 1 reply beneath your current threshold.
    • Re:Cryptic? by bill_mcgonigle (Score:2) Thursday February 22 2007, @12:39PM
    • In theory yes. In practice no. by jotaeleemeese (Score:2) Friday February 23 2007, @11:35AM
  • 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.
  • Not always cryptic (Score:1)

    by ErGalvao (843384) on Wednesday February 21 2007, @04:22PM (#18101188)
    (http://www.galvao.eti.br/ | Last Journal: Monday March 19 2007, @06:06AM)

    [...] 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.
  • Rexx (Score:2)

    by LeninZhiv (464864) * on Wednesday February 21 2007, @04:39PM (#18101452)
    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...
    • Re:Rexx by LMacG (Score:2) Wednesday February 21 2007, @04:54PM
      • Re:Rexx by LeninZhiv (Score:2) Wednesday February 21 2007, @05:23PM
  • Picking Up Perl (Score:5, Informative)

    by nbritton (823086) on Wednesday February 21 2007, @04:46PM (#18101550)
    This: http://www.ebb.org/PickingUpPerl/pickingUpPerl.pdf [ebb.org] 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 [jimsannex.com] 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 [activestate.com]
    http://www.crimsoneditor.com/ [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;
  • by massysett (910130) on Wednesday February 21 2007, @04:59PM (#18101766)
    (http://www.smileystation.com/)
    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 [swtch.com] 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.

  • perl5 has run it's course (Score:4, Insightful)

    by mo (2873) * on Wednesday February 21 2007, @05:09PM (#18101884)

    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.
  • minnie pearl (Score:2)

    by trb (8509) on Wednesday February 21 2007, @05:17PM (#18101994)
    It's about time Minnie Pearl got some attention around here.

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

  • Arguably... (Score:1, Flamebait)

    by Limecron (206141) on Wednesday February 21 2007, @05:20PM (#18102024)
    "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. :)
  • Excesive verbiage (Score:1)

    by Logic and Reason (952833) on Wednesday February 21 2007, @06:38PM (#18102912)
    (http://gardnerman.com/)
    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.
  • by jozeph78 (895503) on Wednesday February 21 2007, @07:26PM (#18103382)
    If I'm well skilled in BASH plus sed and awk, what does perl buy me?
  • by kindbud (90044) on Wednesday February 21 2007, @08:07PM (#18103704)
    (http://www.thekindbud.com/)

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

  • by daves (23318) on Thursday February 22 2007, @08:18AM (#18107682)
    (Last Journal: Monday August 20 2001, @01:45PM)
    ... is Perl 4. Object Oriented structures did not go easily into the language.
  • by yumpy (1067330) on Thursday February 22 2007, @02:32PM (#18112288)
    (http://minimalperl.com/)
    http://minimalperl.com/ [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!
  • Not by novice (Score:2)

    by renoX (11677) on Thursday February 22 2007, @06:11PM (#18115740)
    "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.
  • Re:Cheaper at Amazon. (Score:1, Troll)

    by Lockejaw (955650) on Wednesday February 21 2007, @03:44PM (#18100652)
    Congratulations, AC, you've discovered that used books are cheaper than new ones.
    [ Parent ]
    • 1 reply beneath your current threshold.
  • Re:PERL backronym (Score:5, Funny)

    by morgan_greywolf (835522) * on Wednesday February 21 2007, @03:55PM (#18100808)
    (http://stylus-toolbox.sf.net/ | Last Journal: Tuesday May 15, @11:50AM)
    Nope.

    Stands for Python'll Eventually Replace this Language.

    or, optionally:

    Perl Eats Ruby for Lunch :-D
    [ Parent ]
  • Re:Python (Score:1, Funny)

    by licious (932923) on Wednesday February 21 2007, @04:00PM (#18100886)
    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.
    [ Parent ]
    • Re:Python by eneville (Score:1) Thursday February 22 2007, @07:55AM
  • by halivar (535827) <bfelger@NOsPaM.gmail.com> on Wednesday February 21 2007, @04:14PM (#18101068)
    (http://bfelger.net/)
    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!
    [ Parent ]
  • by Goaway (82658) on Wednesday February 21 2007, @04:29PM (#18101284)
    (http://wakaba.c3.cx/)
    Nice list of languages nobody uses there.
    [ Parent ]
  • 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.
    [ Parent ]
  • by Fahrenheit 450 (765492) on Wednesday February 21 2007, @04:34PM (#18101378)
    I'd guess that it is one of the greatest languages in the same sense that McDonald's is one of the greatest restaurants.
    [ Parent ]
  • by Chysn (898420) on Wednesday February 21 2007, @04:52PM (#18101644)
    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.
    [ Parent ]
  • 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.
    [ Parent ]
  • by qwijibo (101731) on Wednesday February 21 2007, @05:15PM (#18101980)
    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.
    [ Parent ]
  • by David Greene (463) on Wednesday February 21 2007, @11:07PM (#18105004)

    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.

    [ Parent ]
  • by Lord Ender (156273) on Thursday February 22 2007, @10:28AM (#18108832)
    (http://127.31.33.7/)
    It amuses me that any criticism of Perl in this story gets buried to -1 by the mods. Yay discussion.
    [ Parent ]
  • 13 replies beneath your current threshold.