Slashdot Mirror


Perl's Glory Days Are Behind It, But It Isn't Going Anywhere

snydeq writes "Deep End's Paul Venezia waxes philosophical about Perl stagnancy in IT. 'A massive number of tools and projects still make the most out of the language. But it's hard to see Perl regaining its former glory without a dramatic turnaround in the near term. As more time goes by, Perl will likely continue to decline in popularity and cement its growing status as a somewhat arcane and archaic language, especially as compared to newer, more lithe options. Perhaps that's OK. Perl has been an instrumental part of the innovation and technological advancements of the last two decades, and it's served as a catalyst for a significant number of other languages that have contributed heavily to the programming world in general.'"

51 of 379 comments (clear)

  1. Wait, what? by girlintraining · · Score: 5, Insightful

    So let me get this straight: A programming language that found a niche, became massively popular, and is now widely used... is a failure in your eyes because it's not in a constant state of change?

    You're kidding, right? The epitome of a successful programming language is that it has become flexible enough to meet the needs of its users without requiring more than maintenance fixes. This is like saying "grep is useless because nobody's completely redesigned in in the last few months!" Dude, stop drinking the Web 2.0 kool-aid. There are things in the computer world that aren't meant to change every day. I know it's hard to imagine when every pundit is screaming "release early, release often" from every rooftop, but speaking from experience... If you go mangling your programming language every few months like (cough, .NET) some companies do, you're going to find your developers bailing out like rats from a sinking ship.

    --
    #fuckbeta #iamslashdot #dicemustdie
    1. Re:Wait, what? by LordLucless · · Score: 4, Insightful

      So let me get this straight: A programming language that found a niche, became massively popular, and is now widely used... is a failure in your eyes because it's not in a constant state of change?

      Uh, no, that'd be you putting words into the writer's mouth. How about this:

      As more time goes by, Perl will likely continue to decline in popularity and cement its growing status as a somewhat arcane and archaic language, especially as compared to newer, more lithe options.

      It's not failing because it's not changing, it's failing because less people are using it. The lack of it integrating shiny new features may be one of the factors contributing to this.

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    2. Re:Wait, what? by jellomizer · · Score: 2, Insightful

      Perl popularity is due to its text file processing ability. Back durring it's high points relational databases were expensive and resource hogs. However with faster systems and lower cost or free databases available, Perl need has declined.
      Your sites data is no longer being processes in a large text file but in a database. (Granted the database may internally doing the same thing)
      It isn't that Perl is bad but it just isn't as useful anymore.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    3. Re:Wait, what? by dkf · · Score: 2

      [Perl is] not failing because it's not changing, it's failing because less people are using it. The lack of it integrating shiny new features may be one of the factors contributing to this.

      Maybe, but probably not. It's probably more closely linked with the culture of dodgy human-readability and the changing profile of what people want to do with programming languages. On the first point, the issue isn't that it is impossible to write readable perl — that's emphatically not true — but rather that most perl programmers don't do that; it's a culture thing. The second point is much more to do with perl not being universally present in browsers, or numpy, or rails: some niches where perl wasn't the leader have turned out to be really important (and that's not to deny perl's success in others).

      You can't win them all, and the only constant is change.

      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    4. Re:Wait, what? by girlintraining · · Score: 5, Interesting

      Perhaps a few mandatory rules could fix this problem? Doubt it though because it seems PERL programmers seem to value code over hardware..

      You're blaming poor programming on the language. Perl isn't meant to be a replacement for, say, C, but considering its an interpreted language, running at 1/56th speed of compiled code is not bad. The author here mentions PHP, Ruby, and Python. A separate analysis reveals that PHP is worse. The others are only marginally better because they have a specific function by that particular benchmark test optimized. A separate and equally simple benchmark has Perl on top. I'm sure many will be able to come up with more comprehensive benchmarks, and then a flamewar will erupt... But my point (soon to be lost forever in the ensuing tsunami of replies) is that the usage scenario determines language performance, and in many usage scenarios, Perl is the winner amongst the author's picks. Don't blame the language because the programmer either (a) uses it incorrectly or (b) uses it for something other than it was designed for. Perl is fundamentally about string manipulation and I/O between various datasets and is a high-level language. If you aren't using it for that, you're doing it wrong. Not to say it won't work... but it's not the Right Thing.

      --
      #fuckbeta #iamslashdot #dicemustdie
    5. Re:Wait, what? by dargaud · · Score: 3, Insightful
      Yeah, perl got popular for several reason, such as its ease of string manipulation. But it soon turned into 'use regex for everything'. At the time no other languages (except for sed, but calling it a language stretches it a bit) had easy regex, but that's no longer true. And its extreme compactness is also a hindrance as it turns any reasonably optimized code into symbol soup.

      I also find this TMTOWTDI (There's more than one way to do it) philosophy frustrating. I did Perl for a year, wrote clear but slow progs, went to usenet for advice, got a first prog half as long and twice as fast, then a second... and at the end of the line a great one-liner that was plain impossible to understand.

      --
      Non-Linux Penguins ?
    6. Re:Wait, what? by girlintraining · · Score: 5, Interesting

      It's not failing because it's not changing, it's failing because less people are using it.

      Compared to the alternatives the author suggests? Ruby and Python combined are doing less than Perl. PHP is the runaway favorite, but if you dig into the numbers, you'll find that most of the change is due to Content Management Systems which by and far have been developed on PHP. So these massive zomfg numbers PHP is pulling in isn't due to people programming with it as much as they are copy-pasting it en masse.

      Perl is often custom back-end stuff with little visibility. It runs in cron jobs. It happily links various back-end pieces to one another... doing its unglamorous jobs with ease. Yes, Ruby is pretty and shiny. Yes, Python is a hot thing right now. But I've developed for all of them, and you know what? Perl is still what I'd turn to for back-end work over either of them because it's easy to work with and in many use scenarios I encounter professionally... faster as well. Python starts to choke (badly) in a take-down-the-server kind of way when it gets taxed. Ruby is the same way. But Perl seems bulletproof... even in a resource-constrained environment, it just. doesn't. die.

      And for me, writing code for corporate use... Reliability trumps shiny any day of the week.

      --
      #fuckbeta #iamslashdot #dicemustdie
    7. Re:Wait, what? by tlambert · · Score: 3, Insightful

      As more time goes by, Perl will likely continue to decline in popularity and cement its growing status as a somewhat arcane and archaic language, especially as compared to newer, more lithe options.

      It's not failing because it's not changing, it's failing because less people are using it. The lack of it integrating shiny new features may be one of the factors contributing to this.

      I agree that that's what the article author is saying; he specifically cites release timeliness and "forward progress", which he goes on to define as additional features.

      I think this is in error. Perl is less maintainable than other languages, due to the myriad of "correct" was to implement solutions to various problems, and once the challenger language in question has evolved to the point that it can map a sufficient portion of the problem space mappable by perl, it was inevitable that it be displaced. As the article author states, it's not going anywhere, but, like COBOL, you aren't going to be seeing significant new code bases written in the language.

      Python, I think, owes its popularity in no small part to being an official language in places like Facebook and Google; perl is specifically prohibited in all cases in both companies. If one language is used by a company where it's desirable to work, and another is prohibited, which language are you going to learn?

      PS: I think the best place to look for perl's health, or lack thereof, is the coverage for systems interface changes in CPAN. If perl get coverage for significant new APIs, but not other APIs, then it's still alive; otherwise, it's on its way to legacy code and/or deprecation. For example, if there's support for membuf, ioevent, and similar interfaces, I'd say perl was far from dead.

    8. Re:Wait, what? by girlintraining · · Score: 3, Interesting

      However with faster systems and lower cost or free databases available, Perl need has declined.

      I don't think that's what's driving the numbers down; It's the Web 2.0 culture. There are a lot of self-contained solutions (such as content management systems) built on PHP, etc., that pretty much you unpack into a directory, set the permissions and tweak a config file, and you have a usable app. Perl was never about that. Perl is like duct tape -- you use it to glue things together.

      --
      #fuckbeta #iamslashdot #dicemustdie
    9. Re:Wait, what? by e**(i+pi)-1 · · Score: 2

      Second that. Perl is great exactly because it is stable, reliable and because of the prospect that it will remain so. Like the Unix shell, Latex or plain old C. Its maybe as close as one can get to mathematical tools, which by default never change. A language has to earn the status of being archane. Thats when it can be used also within larger projects without worry that basic functionality is depreciated. Its not an exclusive or. The world needs both, new languages which are exciting but change often and old languages which have a track record of being robust.

    10. Re:Wait, what? by solidraven · · Score: 5, Insightful

      No, you look at Perl in the wrong way! The camel is good at what it's designed for. It won't do it neatly but it'll get the job done. Need to hack two incompatible systems together quickly? Perl is there for you. Need low level access from a scripting language? Perl fills the gap. And in terms of performance the old camel still gives a lot of new "optimized" languages a run for their money. It's also one of the most flexible languages out there. Name a few other scripting languages that are used on such a wide range of systems? You'll encounter Perl on the small embedded systems and on large clusters. It simply adapts to the task at hand. It's sort of like Fortran and Ada in that, many people are against it but those who are familiar with it know what it's capable off aren't going to drop it cause it looks ugly to the younger programmers.

      In case you're wondering Fortran is the best data crunching language out there and Ada is in a league of its own when it comes to reliability. Idealism doesn't have a place in engineering, you use the right tool for the job and stop whining about how easy it is to use or master.

    11. Re:Wait, what? by Viol8 · · Score: 2

      "The lack of it integrating shiny new features may be one of the factors contributing to this."

      Nah , IMO its because people only used Perl because there was no alternative for problems that required a scripted solution that couldn't be done with shell or awk and where C/C++ would be overkill. Now we have Python which is what most people would consider a "proper" language rather than the rather messy line noise that is Perl.

    12. Re:Wait, what? by Anonymous Coward · · Score: 4, Informative

      I'd still say they don't have an easy regex.

      Perl's is an actual operator in the language, all other languages require you to build and use a regex object... which means 1 line in perl requires more lines (define+create, then test) in others to do the same.

    13. Re:Wait, what? by ThePhilips · · Score: 4, Insightful

      That is excellent. Considering that that particular benchmark is arithmetical and Perl has nearly zero optimizations for the arithmetic.

      --
      All hope abandon ye who enter here.
    14. Re:Wait, what? by Tridus · · Score: 4, Insightful

      That "bloody whitespace" is one of the reasons your average python code is more readable than your average perl code. You don't see a lot of python code that should actually be 30 lines but is crammed into one because the developer though that line breaks are some kind of precious resource.

      --
      -- "So they told me that using the download page to download something was not something they anticipated." - Bill Gates
    15. Re:Wait, what? by rgbatduke · · Score: 3, Interesting

      And C is the best to write operating systems (and a lot of other stuff) in and APL is actually pretty nifty for writing certain kinds of vector code and...

      Personally, I still love Perl and use it by preference when I need a short one-off program that doesn't have to be fast, especially one that does a lot of parsing. It is a great on-the-fly translator, and is often used to facilitate data conversion of one sort or another because it is so easy to use for that purpose. I have written far more complicated stuff -- actual interactive GUI applications -- in Perl, but that's where one is probably pushing it outside of its area of primary utility and I probably won't do that again. And yeah, one of the best features of Perl is its ability to split lines and do regex processing in a syntactically compact way. Tools like awk/sed/bash are also very useful for doing simple stuff -- pattern matches and substitutions -- but sed rapidly becomes arcane to the point where one has to keep a library of sed 1 liners or examples handy to remember how to pull the third octet out of an IP address, add 24 to it, and write it back or the like. In Perl doing this takes several lines of code (if you want the result to be readable) but it is easy and robust to code and understand. I used to use awk a lot (15-20 years ago), but Perl completely superceded that. I do still use sed simply because s/aaa/bbb/g is so damn useful on the fly, more so if you chain several sed conversions and other stuff together in a pipe. But once the complexity passes a fairly low threshold, Perl is very much a tool of choice.

      Of course it is not unique. Nowadays, lots of people like other similar languages e.g. python that serve more or less the same space. But arguing about which of the available languages is "best" is a fruitless exercise. Philosophically they are very different. Some people like what I would call "fascist" languages (where python is in that category IMO) with strict rules on e.g. indentation and structure. Some people like loose, free languages that don't care how you indent and use brackets instead. Some people like procedural languages. Some people like object oriented languages. Some people are agnostic and like languages that do both, each in its place. And whatever the programmer likes, there is also the task -- some tasks manipulate data or perform computations in procedural ways, some work with data objects.

      Personally, I think any rumor of the demise of Perl is likely exaggerated and premature (and I'd want data to support it!) I use it all the time, and obviously I wasn't surveyed. A lot of the rise and fall of scripting languages is dictated by what schools are teaching and what people need in jobs, and these days it is dominantly java (or javascript), python (because it is easy to teach structured programming in python), php (because it enables web programming), and even "html" (which isn't really a programming language but so what). For web programming -- a major if not the major marketplace for programmers -- and even for database programming (web interface to database) this set makes sense. Perl was popular early on for writing web scripts because it worked, but it wasn't really designed for that purpose and languages that were (but were otherwise remarkably perl-like) eventually won out. So what? That wasn't what Perl was written for, and it's not what it does best.

      rgb

      --
      Even when the experts all agree, they may well be mistaken. --- Bertrand Russell.
    16. Re:Wait, what? by Viol8 · · Score: 3, Interesting

      "I think Perl's biggest problem is it's liberal use of $ % @ etc operators in variable names. I like them. They're there for good, cool reasons;"

      No they're not. There is no good reason for having to tell the interpreter the type of the variable once its been created. It should already know. Its just pointless noise that doesn't need to be there and reduces readability. The reason shell script does it is because it needs to know if its a variable or program name, perl doesn't have that restriction.

    17. Re:Wait, what? by ThePhilips · · Score: 2

      It'll be nice if there could be a JIT or some other accelerator for Perl.

      I have seen some old posts about attempts to port Perl's interpreter to LLVM to be able to take advantage of its JIT facility. As far as I can tell, it didn't went too far. (The most discussion I can find. But about work from 2008-'09.)

      Main obstacle for Perl's advancement and progress is the Perl6.

      You can't change the Perl5 because a lot of stuff depends on it.

      You can't make new version of Perl out of Perl5 because Perl6 is already out there.

      All in all, I strongly believe that it is the miserable failure of Perl6 what's killing any potential progress the Perl could have made.

      Right now, the best thing which could happen to Perl IMO is a fork of the Perl5. Yet, since user/developer base is declining, I very much doubt that would happen.

      --
      All hope abandon ye who enter here.
    18. Re:Wait, what? by stjobe · · Score: 3, Informative

      From perlfaq1:

      What's the difference between "perl" and "Perl"?
      "Perl" is the name of the language. Only the "P" is capitalized. The name of the interpreter (the program which runs the Perl script) is "perl" with a lowercase "p".
      You may or may not choose to follow this usage. But never write "PERL", because perl is not an acronym.

      From wikipedia:

      Though Perl is not officially an acronym, there are various backronyms in use, such as: Practical Extraction and Reporting Language.

      From Learning Perl, 2nd Ed:

      Perl is short for "Practical Extraction and Report Language," although it has also been called a "Pathologically Eclectic Rubbish Lister." There's no point in arguing which one is more correct, because both are endorsed by Larry Wall

      Either way, typing the name of the language in all-caps is wrong.

      --
      "Total destruction the only solution" - Bob Marley
    19. Re:Wait, what? by cmdr_tofu · · Score: 2, Interesting

      First off, I love Perl, but I hate it too. All of my backend code used to be Perl, but I long since abandoned it for Ruby. Now when I have to use Perl, it's usually called from a Ruby script and I real the Perl output into Ruby through JSON.

      As far as performance is concerned, i think Python is really a top contender with native thread support, but generally for sysadmin stuff, you don't always need a high-performance solution. For something that is easy-to-write, and easy-to-manage, and almost more importantly easy-to-read-the-code-2-months-later, Ruby is great. I have nothing bad to say about Perl, but there are clearly some advantages (when using objects especially) to Ruby and Python. The Perl community (perlmonks.org) is the best programming community I've ever come across. The only reason I even switched to Ruby was because I believed that Parrot would bring a convergence and interoperabilty between Perl 6, Ruby and Python.

      If Perl becomes less relevant in the future it would make me sad.

    20. Re:Wait, what? by arielCo · · Score: 4, Insightful

      $foo is one (scalar) variable, which is not the same as @foo (array), and %foo (hash) and foo (file handle), which can coexist without interference, and no Perl programmer will be confused by that (we actually think of the sigil as *part* of the name, as in "dollar foo" and "percent foo"). So it's not redundant syntax, which Perl avoids like the plague.

      They're also there to ensure that you're getting the right kind of value when you build an expression, like @stooges = @people{('curly','larry','moe')} (stooges is an array, people is a hash). That is the kind of compact syntax that makes it popular as opposed to iterating over the keys to add the values to the array.

      --
      This post contains no rudeness or derision of any kind. All arguments are friendly. Terms and exclusions may apply.
    21. Re:Wait, what? by guacamole · · Score: 2

      I am trying to remember where I read this, but I think I indeed heard somewhere that Python's solution under certain out of memory conditions is simply to die and exit. But still, I wouldn't discount Python as a fragile programming language. One good testament to Python's reliability is the fact that much of mailing list servers are now running GNU Mailman. GNU Mailman was what put Python on the map for me. Before Mailman, I thought no one in their right mind would write mailing list software in anything other than Perl. I was wrong.

      Perl will probably linger as the language for unix scripting tasks for a long time. After all, this is how it got started. And then there is the huge library of code at CPAN that's extremely important on its own. I do think that Python is a better general purpose programming language. It's now used for a very wide range of tasks, from teaching computer science algorithms to numerical number crunching with scipy. Perl never quite got a lot of traction in such areas.

    22. Re:Wait, what? by spxZA · · Score: 5, Informative

      In my third year of varsity, we had to write a search engine with indexing stored in files. My Perl solution returned results twice as fast (averaging 22ms/query) as any other in the class, most of which were C or C++. And it took me half the time to write.
      I love Perl mainly because of I am a lazy programmer. Yes, most of my Perl scripts take a little bit longer to execute, but we're talking a difference of seconds or minutes, not hours. There are times where I choose Perl, Python, C/C++, PHP, etc, but this depends entirely on the problem and the circumstances. I will use Perl until I die, even if there aren't any more releases from now on.
      Should we lament Bash for the same reasons? The last release (4.2) was 13 Feb 2011, and the last feature release (4.0) in early 2010. ZOMG!

    23. Re:Wait, what? by smpoole7 · · Score: 2

      > actual interactive GUI applications

      Or games. :)

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

      One of my favorite games was written in Perl, using the SDL for the graphics.

      Whether it was the "best" choice or not is for another debate. But you're right, if you want to think outside the box, Perl will go there, too. :)

      --
      Cogito, igitur comedam pizza.
    24. Re:Wait, what? by mooingyak · · Score: 2

      $foo is one (scalar) variable, which is not the same as @foo (array), and %foo (hash) and foo (file handle), which can coexist without interference, and no Perl programmer will be confused by that (we actually think of the sigil as *part* of the name, as in "dollar foo" and "percent foo"). So it's not redundant syntax, which Perl avoids like the plague.

      They're also there to ensure that you're getting the right kind of value when you build an expression, like @stooges = @people{('curly','larry','moe')} (stooges is an array, people is a hash). That is the kind of compact syntax that makes it popular as opposed to iterating over the keys to add the values to the array.

      So you're saying that you can have @foo and %foo, and then assign @foo = @foo{('curly','larry','moe')}, and the lhs @foo refers to something different than the rhs @foo? And that's not confusing?

      --
      William of Ockham had no beard. The most likely explanation is that it was chewed off by squirrels every morning.
    25. Re:Wait, what? by laffer1 · · Score: 3, Interesting

      I don't think less people are using Perl. I think young people aren't using perl. The hot thing is Python and JavaScript solutions for everything. Python can be used for GUIs, crazy admin scripts, etc. It can be used in place of Perl, but it will never replace Perl. Python doesn't have CPAN. Python code is just as bad as Perl code sometimes, because people who use both languages are sometimes too clever for their own good. Personally, Perl makes more sense to me than Python. I get why people like Python, but it's not for me. After trying to port it to MidnightBSD, I had to look inside and I was not impressed. Then there's the whole Python 3 thing... too many people still use Python 2.x. Python 3 is what will happen if Perl ever actually goes to 6.0 (mainstream). You'll have a fork and then death of the language long term. It's only a matter of time. I think the Python community either has to go back to 2.x or kill security updates on it so it forces people to adopt 3.x.

      No one has ever shown me a feature in Python I can't live without. I would never write a GUI in Perl, but I also think it's ridiculous in python aside from prototyping. If you want evidence of why I feel that way, look at many Gnome projects. I have done it once as a script to create PDFs of web pages with their actual rendering from WebKit bindings for my previous employer and I got a bad taste in my mouth.

    26. Re:Wait, what? by arielCo · · Score: 2

      Not to someone who already knows Perl, because by the time he sees that he's already familiar with $foo, @foo, $foo[2] (third element in @foo), %foo, $foo{'bar'} (value stored in %foo under 'bar'), though it IS bad form. Yes, it's not for the casual observer and *really* messy code can be written, but good style helps a lot.

      --
      This post contains no rudeness or derision of any kind. All arguments are friendly. Terms and exclusions may apply.
    27. Re:Wait, what? by rgbatduke · · Score: 2

      I used Perl-Tk for mine -- SDL wasn't around yet IIRC, nor was Gtk, and I was porting an interface I originally wrote in Tcl/Tk once I realized that Tcl was insanely out of sync with the way I think and code. In the end it worked perfectly, but it was a bit of a mess to write. Not an exercise I'm eager to repeat (and I long since learned to code in C/Gtk for the same kind of application), but I still have the source squirrelled away in case I ever need to recycle it in some way. But the amazing thing about a dancing bear isn't how gracefully it dances but that it dances at all. A >>simple Tk interface in perl was, and probably still is, a piece of cake and you have all of that string parsing power just sitting there at your beck and call.

      Games, though -- wow! But then, as one of the top posters noted perl is relatively efficient as scripting languages go, sometimes within an order of magnitude of compiled code. Hard to do much better than that with any of the languages that do dynamical allocation of all variables as you use them, creating everything as complex opaque hashes behind the scene just so you can address a[34] without defining or allocating a or even assigning values or referencing a[0] to a[33] (where I'm deliberately leaving off the $ -- this remark isn't only about perl). The same thing that makes it perfect for sloppy one-offs makes it slow for everything else, but slow is relative, given computers with several billion instructions per second at your disposal. In lots of cases, the time required to write the program is vastly greater than the time required to run it, so writing in an easy and forgiving language where you can dash off working code in thirty minutes instead of a couple of days is totally worth it.

      rgb

      --
      Even when the experts all agree, they may well be mistaken. --- Bertrand Russell.
    28. Re:Wait, what? by Rysc · · Score: 3, Informative

      Confusing is in the eye of the beholder. Consider

      sub read_file{
          my $file = shift;
          open(FILE, $file) or die "$!";
          chomp(my @file = <FILE>);
          close(FILE) or die "$!";
       
          my %file;
          while my $line (@file){
              my($key, $value) = split /=/, $line;
              $file{$key} = $value;
          }
          return %file;
      }

      To a Perl programmer this is all very clear despite having multiple things called 'file' in the same scope. What would you prefer? "$file, $file_handle, $file_array, $file_hash"? There are a lot of things you could do instead but they're not much clearer or easier to read, and this is more than sufficiently clear.

      And before you say anything, yeah this is not the best way to write such a function. If you're thinking "WTF?" the answer is "For illustration I went with something that should be fairly clear to non-Perl people" and "I'm trying to use as many different types of variable as possible."

      --
      I want my Cowboyneal
    29. Re:Wait, what? by muon-catalyzed · · Score: 4, Funny

      >You are not supposed to understand the code

      Right, that is because Perl is the only language whose code looks the same before and after RSA encryption.

    30. Re:Wait, what? by dskoll · · Score: 3, Insightful

      That's utter nonsense. Perl's DBI modules are fantastic for DB access.

      Perl is just not shiny and new any more. It's still used in a lot of places. Our commercial products are written in Perl and I like the fact that Perl isn't changing wildly. Perl 6 worried me for a while, but it's obvious that Perl 6 is going nowhere and Perl 5 is continuing to be maintained.

    31. Re:Wait, what? by Bogtha · · Score: 2

      One of Perl's biggest uses was web development. At one point, server-side web development was totally dominated by Perl. These days it's a niche player.

      The other biggest use was sysadmin scripting. Again, it is rapidly falling by the wayside as systems like Chef and Puppet automate away a lot of it and Ruby and Python are growing in popularity for the rest.

      This isn't about times changing and people needing different things. Perl's getting outpaced in areas where it has traditionally been extremely strong.

      --
      Bogtha Bogtha Bogtha
    32. Re:Wait, what? by Wdomburg · · Score: 2

      Not particularly good naming, you're calling a file name, lines of input and formated output all "file". With more sensible naming:

      sub read_file{
              my $filename = shift;
              open(FILE, $filename) or die "$!";
              chomp(my @lines = );
              close(FILE) or die "$!";

              my %data;
              while my $line (@lines){
                      my($key, $value) = split /=/, $line;
                      $data{$key} = $value;
              }
              return %data;
      }

      Of course once you remove the dubious reuse of the same variable name for different types, the sigils are rendered unnecessary and confusing. The same steps in Ruby:

      def read_file(filename)

              file = File.open(filename)
              lines = file.read.split($/)
              file.close

              data = {}
              lines.each do |line|
                      key,value = line.split('=')
                      data[key] = value
              end

              data
      end

      Which looks cleaner?

    33. Re:Wait, what? by gregor-e · · Score: 2

      I enjoyed lunch with Larry at OSCON in 2009. I asked when Perl 6 would be done, and he assured me it would be ready by Christmas.

  2. Still widely used for good reasons (and some bad) by eksith · · Score: 2
    There's this misconception that Python (the new hotness after some people started getting bored with Ruby) was being adopted purely due to it being new and... well, popular.

    We see that Python has a sizable lead on Perl, and oddly, the popularity of Bash has risen sixfold over the past year, breaking into the top 20 for the first time ever.

    The fact is that Python today is taking over where Perl would have dominated in the past. That is applications, front-end scripting and where integration of both would be beneficial. If it weren't for Python, I doubt legacy apps that are being migrated away from Perl would have had that path ahead of them. It's a much muddier road through Ruby (not criticism of the language itself, but things are too... different than Python).

    --
    If computers were people, I'd be a misanthrope.
  3. Re:Still widely used for good reasons (and some ba by Viol8 · · Score: 3, Informative

    "The fact is that Python today is taking over where Perl would have dominated in the past. "

    And the reason for that is that python has equivalent functionality to perl (unless you really need to compose an entire program in 1 line of regexp and a loop), can also be used for quick-n-dirty tasks but is actually readable and structured and while its OO system isn't perfect its a damn site better than the nailed on dogs dinner that is Perls.

  4. So, in a few years time... by ebbe11 · · Score: 2

    ...Perl will just as dead as Fortran and COBOL.

    --

    My opinion? See above.
  5. Re:Perl for sysadmins by guacamole · · Score: 5, Interesting

    Perl is certainly right for sysadmins. First, Perl borrows heavily the ideas/syntax/cues from the standard unix shell scripting. I am talking about writing scripts with bash, awk, sed, grep, find, tr, etc. If you know them, you will fee right at home. Perl glues the ideas of all of these tools together into a more consistent syntax, and runs much faster than the speed most shell scripts could ever achieve.

    Another important issue is the community. Perl community is filled with people who do system administration (not that there aren't other users of perl), so there are tons of libraries, which are available to use as easily as starting Perl's CPAN shell and having it install them automatically. The best book to learn Perl is Larry Walls "Programming Perl". A new edition just came out.

    Having said this, I want to mention a that it's a good idea to develop a good sense of judgement. For example, I always got annoyed by some fanboyish coworkers who wrote Perl scripts when a simple shell script would suffice. I have seen perl scripts that are filled with calls to external shell commands, cp and rm and so on which I thought was stupid. (Need a shell script? just write a shell script). And I still loving using awk and similar tools for writing most of "one-liners". I always found awk to be a bit better suited for that than perl. On the other hand, know when to start writing Perl script instead of shell script. Shell scripts can get clumsy very fast.

    Another advise, you may also want to check out Python. I was a Perl person, and recently looked into Python, and lo an behold, I am very impressed. In my opinion Python sets a new standard in cleanness and readability. Take a look at the free book "Dive into Python" as well as the official Python 3 tutorial online. Both are short and can be covered in just a few study sessions. Still, in sysadmin world Perl may be more useful, but Python is a great all-around general purpose language.

    To see what I mean, take a look at this discussion

    http://stackoverflow.com/questions/3775413/what-is-the-perl-version-of-a-python-iterator

    compare the tidy Python code at the top with the proposed Perl solutions below.

    Finally, the most striking tool I have used when working as a sysadmin was CFengine. It's the bomb try it. It's a very high level declarative programming language for managing large sites/infrastructures.

  6. What is Perl? by prefec2 · · Score: 4, Insightful

    Perl is a historically a combination of bash, awk and sed. And for purposes well suited where people would use the former three tools to implement shell scripts to help administration tasks on a daily basis. However, Perl is not so well suited for other purposes, like small and medium sized web applications. Therefore, it will not gain any more ground in that area, as better tools are available. The first Perl enemy was PHP. While PHP sucks in many ways, it was better designed to write simple dynamic web pages. Today it is used for medium sized web applications, which is clearly a dangerous thing, but still it restricts the growth of Perl in that direction, as younger coders came first in contact with PHP and all the hosters support PHP, but not everyone is supporting Perl. Also things like Joomla or Typo3 are PHP based and many people start coding by extending them.

    For custom application or other mostly larger system Java-based or .NET-based technologies are used. Perl has nothing to do in that area. It lost its job there many years ago. InterShop was once coded in Perl, but - well - who cares?

    As the Unix command shell is only a limited realm (in number of installations), Perl will never become that widespread again. At least that is my assumption considering today software base and structure, as well as the education in programming languages.

    1. Re:What is Perl? by guacamole · · Score: 3, Insightful

      And then don't forget the threat from Python. Python is a true general purpose scripting language. You can do web applications, sysadmin scripts, or say numerical number crunching (see scipy and numpy). It has very clean and simple syntax rules. On the other hand, Perl looks like an alien language to people who are not familiar with unix.

  7. Re:Any talk along this vein by prefec2 · · Score: 2

    PHP is a nightmare. However, most problems with PHP and Perl-web-applications are the bugs in those applications and not in the language runtime environment.

  8. Re:Still widely used for good reasons (and some ba by Anonymous Coward · · Score: 3, Informative

    No. Just no.

  9. Re:Still widely used for good reasons (and some ba by guacamole · · Score: 2

    I agree 100%. Python sets a new standard in simplicity and readability. I don't think Perl 6 will be an improvement upon Python in this area. Python now absorbs all the new users. It even has a big traction in the CS education now (Perl never quite got there). Suffice to mention that big CS departments like MIT and Berkeley have started using Python in their intro to CS courses instead of Lisp. It's on clear to me why anyone other than Unix sysadmins should use Perl for new projects instead of Python. In fact, Python is probably just as fine as a sysadmin tool.

  10. Re:Perl's a mess by vlm · · Score: 3, Informative

    On the one hand, with Perl, you can't even create and use a multi dimensional array without barely comprehensible hacks.

    Unimpressed.

    http://perldoc.perl.org/perldsc.html#ARRAYS-OF-ARRAYS

    $AoA[0][0] = "Fred";

    print $AoA[0][0];

    I will give you that iteration syntax over a AoA can look a little weird to the uninitiated.

    I pretty much stopped using multidimensional arrays as a complex data structure when I learned OO except for the obvious mathematical applications. Although for hard core math I tend to take advantage of octave. I've used Inline::Octave from cpan but thats kinda weird.

    I wouldn't do massive scale text processing in Octave unless I had a really good reason, much as I wouldn't do massive math work in Perl unless I had a really good reason.

    The easiest "hack" on AoA is not to use them, if the application is simple enough. If you just need a crude data store just make a simple hash. So instead of [2][3][4] as a 3-dimensional coordinate, just store "2 3 4" as a hash key.

    --
    "Science flies us to the moon. Religion flies us into buildings." - Victor Stenger
  11. Re:awk? by guacamole · · Score: 2

    Awk is fine strictly as a filter. E.g. read formatted input, do something, write output. If that's all you need to do, awk is often sufficient. Perl on the other hand as a great connectivity to the operating system calls, data bases, networking, etc.

  12. Those are called sigils. by kleinesRaedchen · · Score: 2

    By separating variables to a namespace new keywords could be introduced anytime. Just try this in a language without sigils. So, it's a cool feature guaranteeing compatibility of nowadays Perl scripts with Perl interpreters in 3012.

  13. Language Design by YojimboJango · · Score: 5, Interesting

    I wrote this a while ago, but I find it's useful to post it here:

    The precondition that you can write terrible code in any language is a mental diversion. You must design languages for people that believe in intelligent design.
    If there is low hanging fruit in your garden of eden, people are going to assume that someone vastly smarter then they are placed it there for plucking.
    Not even God himself coming down from on high and face to face telling every member of the human race not to touch it is going to keep it from being abused.
    That is the true nature of humanity and by inclusion programmers.

    perl: An unorganized, but sprawling garden full of almost every imaginable fruit. Regex is a shiny sinful apple at eye level on every single tree. The only way to navigate the garden is to ask the snakes.
    python: An organized garden that has one of each kind of fruit. But it's half way through being dug up and replanted into an even more organized garden.
    ruby: A newer garden. Heaps of fertilizer make everything grow incredibly fast, but the trees are getting tangled and there's a problem with weeds.
    c#: Someone spent a lot of money crafting this garden correctly. They also planted trees that emit a hypnotic pollen that will murder you if you try to leave the garden.
    java: A beautiful garden but only when viewed from space. Every tree has exactly 1 fruit, and getting anywhere takes forever. Recently taken over by someone interested in c#'s hypnotic pollen trees.
    c++: An industrial farm complete with tractors and combine harvesters, but no safety equipment. As a bonus 98% of the farm does not contain buried land mines.
    c: A plot of land and a barn full of seeds. Get to work.
    javascript: There's only 1 tree and it grows upside down, but you can find it resurfacing in all the other gardens. It's also sentient, growing rapidly, and trying to murder you.

    1. Re:Language Design by cpghost · · Score: 2

      Beautiful garden analogies. I'm wondering what CommonLisp, Scheme and Prolog would be like. Or even ML and Haskell if you're truly masochistic.

      --
      cpghost at Cordula's Web.
  14. stagnation can be beneficial by CaptainNerdCave · · Score: 2

    A few years ago, I started trying to learn Ruby, but I quickly changed my mind because the project at large kept changing, and I didn't have time to follow it. Perl's stagnation has made it much easier to use as a resource in places where stability is key.

    Why is Perl great? Very small foot-print, minimal resources for outstanding performance, and flexibility.

    After abandoning Ruby (until they calm down), I started exploring Perl and C/C++ with much better results. In my experience, Perl can be very user-friendly, or it can be cryptic... just like most other languages.

  15. Re:Perl's a mess by Lisandro · · Score: 2

    For myself, I learned Perl first, but was still interested in languages, and so continued with Python, PHP, Java, and so on. For a scripting language, I settled with Python, and feel that it is far superior to Perl in just about every way imaginable (and yeah, I'm a fan of the indentation, too, though I can see that if that's not similar to how you formatted your code in the first place, you'd not be likely to appreciate it. Me, I come from a C background where indentation far more formal than the K&R style was required.)

    I love Python and use it daily, but there's one area where it lacks: speed. Perl is, by far, one of the fastest languages i've used and a very good choice if you're doing heavy batch processing.

  16. Why I still use Perl by KeithH · · Score: 3, Informative

    In a nutshell, I still use Perl heavily because I get paid to produce software - mostly embedded realtime telecom s/w but also a lot of tools as well. Pragmatism dictates that I use the tools with which I am proficient and which are universally available. Twenty years ago, I had to use Bourne shell more than I liked because I could only count on the availability of /bin/sh. Now, I have the luxury of being able to expect /bin/perl (version 5 no less). This counts for a lot in an environment where my hundreds of colleagues and I use hundreds of different servers with different operating systems, distributions, versions, and architectures. Yes, there is a lot to complain about with Perl but at the end of the day, Perl is still an excellent tool for many many problems and won't disappear from industrial applications any time soon.