77

I know it may have been asked before, but here goes nothing...

Is Perl still something that would be considered useful? If someone was a new programmer (either completely new to programming or just a few month/years of experience) would Perl be something to be considered worthwhile to learn?

Is Perl still used with frequency? Is it still popular?

Or is Perl dying out compared to languages like Python, Ruby, PHP, ASP.NET, etc.?

Basically it boils down to this:

  • Is it still used/is it still used frequently? If yes, is it dying? If no, will it make a come back?
  • Is it something that would be worth learning?
  • How does it compare in demand to languages like Python in both popularity and usability/viability? Could languages like Python or Ruby be considered replacements for Perl?

Also, will newer versions of Perl really bring a large improvement to the Perl community, and perhaps bring Perl back to centerstage compared to other languages?

EDIT:

Okay, I suppose here's a better, reworded question:

Is Perl still growing, or is it "dying"? Is it still a language worth learning and using? What projects does it really "shine" in compared to other languages? What makes Perl a language to choose? Essentially: is Perl growing obsolete compared to other languages, and if so, do you expect that to change, or to continue?

And thank you to everyone who has answered so far, the discussion has been really interesting!

Thomas Eding
  • 1,062
  • 1
  • 11
  • 18
Bob
  • 2,790
  • 2
  • 22
  • 18
  • 12
    Let's not lose perspective, according to [TIOBE](http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html) it's still in the top ten, ahead of Ruby and even JavaScript. – Daniel Oct 24 '11 at 20:23

19 Answers19

60

First of all, it's always better to disambiguate.

Businesses talk about Perl 5 when talking Perl, but on a far-far land, beyond deep-thinking island, the design-by-committee tribe is still cooking a hefty slab of Perl 6 (and it's almost ready, with an engine written in Haskell and powered by the tears of the gods)

Ok, that said, what is Perl 5 used for, today?

  • legacy web systems / intrawebs - some just won't die

  • data mining / statistical analysis - the perl regex engine, even if slightly outdated, (PCRE, a spinned off library, tops it up in any possibile way and it's the default PHP engine) is still good for simple analysis

  • UNIX system administration - Perl shall always be installed on UNIX.
    You can count on it being readily available even on Mac OS X.

  • network prototyping - many core network experts learned Perl when it was all the rage; and they still do their proofs-of-concept with it.

  • security - many security experts, too, need fast prototyping. (and fast automated fixes) Perl can, and does, cover for that.

The extensive CPAN collection is very handy, when dealing with prototypes.
(Batteries may not be included, but they're still right there, on the shelf)

Remember drawbacks, though:

  • Object support in Perl sucks hard, you bless references and do unholy stuff in the name of objects, then wonder why you took all the trouble in the first place.
  • Reading other people's Perl is more than a craft, it's science, and a painful one, too.
  • Perl is nifty, it makes you think nifty, it makes you feel nifty, you become a programming rockstar. Now, think about getting up, and going to work in a office full of rockstars: it's a "boat that rocks" hard. Expect wild fluctuations.
ZJR
  • 6,301
  • 28
  • 36
  • On the side: I suddenly realized *I want more* wild fluctuations. Better go find some rockstar programmers. (oh, they're all doing *Ruby*, today) – ZJR Oct 24 '11 at 00:38
  • 19
    @WorldEngineer agreed, but the worst about it is that coming from perl, **Ruby doesn't feel nifty** at all: it just feels like a dumbed down, underperforming, version of perl. – ZJR Oct 24 '11 at 01:00
  • 12
    I only see one drawback there. Personally, I happen to enjoy blessing my references, but, for those who don't, there's Moose (on CPAN), which is a good enough object system that other languages are copying it. And, while I love niftiness, I haven't met that many self-obsessed rockstars in the Perl world. There are far more serious, disciplined developers (who happen to like rocking out in their free time) in the Perl community than there are rockstars. (I explicitly deny being a rockstar programmer until and unless women start throwing their panties at me while I write code.) – Dave Sherohman Oct 24 '11 at 10:29
  • 1
    About the sysadmin item: Yes, there's a lot of Perl, but I see more and more Python there. It's hard to get a "modern" system without Python. Often you can't (easily) install software without them. yum on RedHat&Clonse as well as IPS on solaris11 are written in Python ... don't know how the situation is on current HP-UX or Aix, so, globally, Perl certainly has more adoption, but that seems to change, too. – johannes Dec 10 '11 at 12:25
  • 3
    @johannes gotta still deal with the Van Rossum Law: `"Whenever you find a python executable preinstalled, it's the wrong version"` Corollary: `"sometimes the right version is available, but it has the wrong name"` – ZJR Mar 08 '12 at 23:36
  • As an aside, how many programming projects *should* be built with an OO paradigm? – Spencer Rathbun Mar 14 '12 at 20:27
  • @SpencerRathbun not sure what you're actually referring to here. – ZJR Mar 15 '12 at 00:16
  • Your object support drawback. How many scripts do you write that use an OO paradigm? What if a problem is easier to solve with a functional paradigm? It may be a drawback, but how often does it actually come up? – Spencer Rathbun Mar 15 '12 at 12:24
  • Ah, ok. I'm all, but an OO advocate, but really, serious object support was a major need for Perl. In fact that was the **main reason for the Perl 6 effort**. (the effort that brought us *quantum variables*) You are maybe **confusing OO and, well, Objects**. You don't need a OO solution to everything, but objects are quite handy. And function-wise... I have to update my answer. – ZJR Mar 15 '12 at 13:57
  • 2
    Perl is also still quite big in the bioinformatics space. – dietbuddha Apr 19 '12 at 04:18
  • 3
    +1 for system administration. I've never seen a unix based OS not include perl. I've even seen it in some embedded linux OSs that used Busybox for their userlands – Earlz Oct 29 '12 at 13:56
  • @dietbuddha bioinformatics, quite intesting. I stumbled on [this question](http://programmers.stackexchange.com/questions/92916/why-is-perl-so-heavily-used-in-bioinformatics) whose answers explain this happens because in that field there's a constant need for glue between C, Java, and R solutions, and an already established [bioperl](http://www.bioperl.org/wiki/Main_Page) package providing positive bias toward perl. – ZJR Nov 10 '12 at 01:00
  • 1
    @WorldEngineer, "Ruby is Candy Coated Perl"? Is that a joke. If ruby is a candy coated anything, it's a candy coated SmallTalk. Certainly not perl. Ruby is a super OOP language where every last thing is an object (including literal integers and strings), and Ruby's metaprogramming tends to be more accessible. I have extensive experience in both Perl and Ruby, and they are nothing alike. – Ben Lee Dec 10 '12 at 20:50
  • @BenLee Your rebuttal sounds superficial. Have you tried actual smalltalk programming *(it's ****ed up)* or are you citing (biased) academic sources? Ruby has a solid OOP syntax derived fom java/javascript, and a quirky string processing syntax derived from perl. Smalltalk has the vague notion of objects, and a quirky... *everything* – ZJR Dec 11 '12 at 01:41
  • 1
    @ZJR, I've never actually used SmallTalk, that's just a citation I've read. But my rebuttal is *anything but superficial*. I've spent years writing code in both Perl and Ruby, and Ruby's OOP structure is very different than Perl's. And I think it's comical that you lump Javascript (which I'm also very experienced with) and Java together as if they are at all similar. Javascript doesn't even have OOP (it has functional prototypes only). And the syntax/structure of Java's OOP is completely different than Ruby's (not to mention Java's lack of depth in metaprogramming). – Ben Lee Dec 11 '12 at 16:45
  • @ZJR, as for the quirky string processing similarity between Perl and Ruby, *that's* superficial. Ruby has a few carryover's from Perl's syntax, but the actual handling and using of String's in Ruby is *vastly* different. – Ben Lee Dec 11 '12 at 16:48
  • 1
    Also, it's too late to edit my comment above, but I meant to write "Javascript doesn't even have *classical* OOP (it has functional prototypes only)". It has no formal notion of classes. – Ben Lee Dec 11 '12 at 16:51
23

In my opinion, after working with Perl again after a few years of nearly not using it, it is better than ever. Perl 5 has a lot of awesomeness in CPAN, even OO can be done right now. (Have a look at Modern Perl)

Perl 5 is far from dead. Just have a look at some Perl websites and CPAN and on the horizon there is a whole new language - Perl 6.

There are many ressources on the web, blogs and presentations about why it is not bad and why it has a bad reputation it doesn't deserve - just have look at those to get an understanding.

Nornagest
  • 121
  • 3
  • 7
    In my opinion CPAN is great if you need a wheel of any shape, but less great if you need a car factory. –  Oct 24 '11 at 05:55
  • @ThorbjørnRavnAndersen CPAN is great if you need a wheel of any shape. The problem is that `shape($wheel) == 'round' ? available_in_cpan($wheel) : false;` is not a valid filter. – Jason Lewis Jan 14 '12 at 09:13
  • Just because OO exists in Perl doesn't mean that it's actually good. – kirbyfan64sos Feb 05 '14 at 22:14
22

The main thing Perl still has going for it is CPAN - there are so many pre-written modules that it's very easy to find something you need.

That said, I would not learn Perl. Perl is a great language for people who know it already (like me), but Python seems to be (from my outsider's perspective) a better language for doing the sort of quick and dirty file and text parsing stuff that Perl used to be the "go-to" language for.

Peter Mortensen
  • 1,050
  • 2
  • 12
  • 14
Paul Tomblin
  • 1,949
  • 1
  • 15
  • 19
  • And do you think that gives it an upperhand against other languages? Or does that just bring it equal to other languages. For example, the .NET framework seems also be packed with various useful methods and classes. – Bob Oct 23 '11 at 23:25
  • 6
    @Paul Tomblin - That's a rather crude way to put it. "The main thing perl still has foing for it ..." <- The main thing C/C++ have going for them is that a lot of software is still written in them. Besides that, they're rubbish. – Rook Oct 23 '11 at 23:39
  • Agreed with Idigas, since you could say the same about Java having a lot of packages... – Izkata Oct 23 '11 at 23:45
  • @Idigas Well, C and C++ are both compiled. That gives them the advantage of speed and file size, plus C is really common in embedded systems (I don't mind hating on C++, because I don't like it either). But also, if the CPAN isn't one main thing about Perl, what is the main thing? In what sort of project would it truly shine? – Bob Oct 23 '11 at 23:45
  • 1
    The question wasn't "Is C++ or Java a good language". The question was whether Perl is still viable. And there are two reasons why I'm still writing my web apps in Perl: CPAN and I have a ton of code I've already written. – Paul Tomblin Oct 24 '11 at 00:19
  • @PaulTomblin But, do you think that for those who are either new to programming or new to Perl that Perl is really a good choice? I understand the reason to program in Perl if you already have written a lot of reusable code (and I also understand the great value of CPAN), but do you think Perl itself is still comparable to other languages, or do you think it will eventually be phased out completely by other scripting languages like Python or Ruby? Also, what are your main uses for Perl? – Bob Oct 24 '11 at 00:25
  • 7
    If I were starting now, I'd probably use Python. But I use Perl because I'm good in Perl. – Paul Tomblin Oct 24 '11 at 00:36
  • @PaulTomblin That's actually a really good answer, its obvious to play to your strengths! – Bob Oct 24 '11 at 00:42
  • @PaulTomblin Yeah, I hear ya. I'm pretty good at both, so I use Python whenever possible. – Stephen Gross Dec 12 '11 at 17:14
19

When I decided to learn Perl as my first language a few years ago there were a number of factors that guided my decision:

  • is there a lot of good reference material on the language?
  • can I easily find help with my questions?
  • is the language in active use by a large diverse population?
  • are there active projects that will help me with my goals?

For me the answer was yes. I'm a graphic designer. I learned HTML and CSS years ago but needed to upgrade my skills after clients wanted more from their websites. I had used various php frameworks which gave me the bug to really learn to program. I did a lot of research and found well supported projects like Template Toolkit as well as new ones like Perl Dancer and Mojolicious. The documentation that comes with Perl has been very helpful as well as the library of publications.

I have found the Perl mail lists pretty friendly to beginners and active. On PerlMonks people from all over the world come with questions and answers for a wide range of applications. There are several active Perl news sites, blogs and streams. These resources have taught me a lot about Perl and programming.

Granted, that is MY experience. I don't know exactly how many people log on to these sites, subscribe to the mail lists or build their web applications, for example, using Perl. I also can't comment on how much better or worse my experience would have been had I chosen another language to start off with. I don't doubt I could find many of the same positive aspects in the communities of other languages. I can say I'm still happy with the choice I made.

luis.roca
  • 101
  • 5
  • I learned Perl as my first language in 1996 because I had just switched to Linux from Windows for my primary OS. Perl was never a great web language (although PHP is the pure distillation of all of the evil Perl has to offer), but it is fantastic as a replacement for bash scripts. The issue comes when people try to pretend there's such a thing as a silver bullet. – Jason Lewis Jan 14 '12 at 09:08
16

The popularity of a language has very little to do with its viability or usability. Perl is still a very usable language. Its reputation, deserved or otherwise, as being unfriendly to newbies eventually meant no one new would learn it if they could help it. The only reason I don't use it anymore is that no one else I know uses it anymore.

Karl Bielefeldt
  • 146,727
  • 38
  • 279
  • 479
  • 5
    So doesn't the statement "The only reason I don't use it anymore is that no one else I know uses it anymore" indicative of the fact that the popularity perhaps does have something to do with both its viability or usability? Anyways, that's not the point of my question, what I really want to know, is Perl still useful? When do you choose it over other languages (as in, when does it really shine)? – Bob Oct 23 '11 at 23:23
  • 1
    Lanuages exist as a means of expression to other people, saying that how popular a language is to the value it presents is unfounded in my opinion. – blunders Dec 10 '11 at 12:35
  • 4
    This is very environment-based... If you're a *nix sysadmin, your choices to accomplish common tasks boil down to Perl vs. sed + awk+ grep + bash... and Perl is generally easier than remembering 4 syntaxes for a one-off script. – Jason Lewis Jan 14 '12 at 09:04
12

Perl has its place. Its "bad reputation" is generally due to it allowing you great flexibility to do things that should really be done by a different tool.

If you ask yourself the question "What am I trying to achieve? And are there appropriate tools to deliver this?" then you are part of the way there.

If you are writing a quick script, then using a scripting language makes sense. If you are wanting to create a complex application, then you "could" write it in Perl, but you probably shouldn't.

However, as your question relates to a newish programmer, may I suggest leaving Perl alone for now. Simply because you will learn fewer bad habits from a less flexible language.

Peter Mortensen
  • 1,050
  • 2
  • 12
  • 14
Michael Shaw
  • 9,915
  • 1
  • 23
  • 36
  • 3
    Alright, but Python is a perfectly viable option for creating a quick script as well, but you can also stretch it to create larger programs. Is the same not true for Perl? Does that make Python better than Perl? – Bob Oct 23 '11 at 22:59
  • @Bob: I think it's mostly what you are used to write in and your taste. Sometimes, there is also some handy perl library that you don't have in python and vice-versa. – dagnelies Oct 23 '11 at 23:05
  • @arnaud Okay, but let's just say for the sake of argument that you have a completely new programmer who is going to be forced to learn either Perl or Python as their first language (this is a completely hypothetical situation), do you push them towards Perl or Python? And if they were to take Python, would you advise them to learn Perl as a second language later on, or vice versa? – Bob Oct 23 '11 at 23:10
  • 1
    @Bob: I would suggest him to try python first, it's more noob-friendly. Then, I would tell him to pick a completely different language as second language, like Scheme. – dagnelies Oct 23 '11 at 23:13
  • @arnaud So, all in all, you wouldn't recommend Perl whatsoever? In what situation would you prefer it over another language? – Bob Oct 23 '11 at 23:26
  • @Bob (1st comment) - Perl's number of libraries on CPAN still outrank Python by quite a bit. Also, the situation is never quite as clear as you put it. So it really is hypothetical. – Rook Oct 23 '11 at 23:41
  • @Idigas Alright, just out of curiosity, what would a non-hypothetical, realistic situation be where Perl would clearly be the best choice (either to learn or use in practice)? Where would it clearly shine compared to other languages? Plus, any of the .NET languages would also have access to the entire .NET framework, which truly is a massive collection of useful libraries and classes. How would CPAN compare to that? – Bob Oct 23 '11 at 23:49
  • 1
    @Bob: The entire .NET framework is only available on Windows. In the Unix/Linux space, Perl is a great language for replacing shell scripts, doing system administration, and anything involving lots of text processing and not a whole lot else. It does things directly that (last I looked) Python needed a little bit of structure for. This generally makes Perl a worse general programming language, but better for its more specialized applications. – David Thornley Oct 24 '11 at 14:17
  • 1
    @Bob Actually, that's an interesting point. Perl is really handy if you've got a shell script that is straining the limits of bash. Perl accommodates it pretty easily, since you can just put backticks around most of the commands and it'll still work. – Stephen Gross Dec 12 '11 at 17:16
12

For the record, I've been programming in Perl 5 for around 15 years, so I'm a bit biased. Having said that, I really like Perl. Don't listen to the naysayers, and don't think that its age is somehow an indicator of its shelf live. The best way to look at Perl is to see it in comparison to other languages:

  • PHP - PHP is a pretty good web programming language; don't get me wrong. But, it's only a web programming language. Even web applications need their cronjobs to do clean up processes, and you have to do some strange stuff to make that happen. Never mind having to write a quick script for UNIX administrator or parsing a text file. Plus, PHP doesn't have CPAN.

  • Ruby - The language is too new and "script kiddie" for my tastes. The only thing I hear about Ruby is Ruby on Rails. Perl has Catalyst and Dancer (as MVC frameworks), which are damn fine MVCs, but it's not the cornerstone of the language. You're not going to find "Ruby" as a requirement in job offers any time soon (if ever). Plus, Ruby doesn't have CPAN.

  • Python - In the words of Larry Wall, Python is just snake oil. Python cares about whitespace and the last language I used that cared about whitespace was BASIC. Also, like BASIC, it's was essentially designed to be a easy-to-use beginner's language. Finally, no CPAN here.

  • Java - Java is a problem child language. The concept was to have this virtual machine that runs on any platform, but because of the huge popularity of the language in college courses, you see Java applications every where that they shouldn't be. For example, in-house server-based web applications shouldn't exist. It's a single server with specs they define and it gets wrapped in a separate VM with a limited memory footprint. Java is bloated, and they don't have CPAN.

  • C# - I've actually have been using this language quite a bit now, and I've seemed to have formed a love/hate relationship with it. Being able to overload methods with different parameters is cool and fun. But, if you want a language that will bitch at your every line of code about type casting, then C# is for you. My god, it wants you to put explicit casting EVERYWHERE! Making classes are fun, but you suddenly realize that you're spending more time making classes to make the damn language just WORK than actually writing real code.

    Also, C# doesn't have...okay, it has .NET, which is really good and extensive. However, I still like CPAN better because you can still write your own modules and complain at the author about a bug or design flaw. And they are all free. Plus, Perl is working towards Perl.NET in the future, so we may be designing Windows applications before long.

Perl is a great language that has:

  • Regular Expressions - If it's one thing that Perl can do well, it's text manipulation. Yes, many languages have regular expressions, but Perl has damn near invented them, and there's a reason why grep has a "Perl Regular Expression" mode, or why Oracle has a section on "Perl-influenced Extensions in Oracle Regular Expressions". It's built-in and doesn't require any modules.

  • Flexibility - You have three basic variable types: Scalars, Arrays, and Hashes. That's it. That's all you need. You don't have a int, byte, string, or any of that crap. Perl figures it out just fine. And you can use references all you want without fear of memory leaks or cause the whole PC to crash. The language just works.

  • Portability - Perl works great on the web. It works great in UNIX. It even works pretty well in Windows. It's not pigeon-holed to a single function. It's a jack-of-all-trades, but also a master of (mostly) everything.

  • It's easy to do a lot with a little code - Give me a 1K blank file and I can write all kinds of things with that space. Even a Perl one-liner is great to add into a command line pipe.

  • CPAN - I cannot stress how good it is to find just about anything you need for anything. What is "anything"? Well, how about DB modules for every database or thing you could imagine, ranging from Oracle to iPod to CSV to Adabas to Yaswi? How about several fully featured web servers? How about a Excel file reader, or a SNMP module, or a module that reads comments for debug lines, or modules that help you program faster? A project that I'm doing right now is writing a dynamic Terraria map generator, augmenting from an existing module called Games::RolePlay::MapGen. .NET would never have something like that.

    Plus, it's a breeze to install any module via CPAN. Get it from Debian. Install it from CPAN directly. It does as good a job as apt-get in resolving dependencies. I have no problem telling my sysadmin to install X module from CPAN, since it's just a simple one-liner command.

Yes, it has its flaws, and yes, I'm biased towards it, but you've probably already heard the negatives too many times. They don't outweigh the positives, not by a long shot.

SineSwiper
  • 213
  • 1
  • 2
  • 14
    -1 mainly for not recognising that other languages have tools just as good if not better than CPAN. Maven Central for Java for example? It has more artifacts than CPAN and it's a 0-liner to install Maven artifacts since they automatically get identified through dependency analysis of the Project Object Model. Also I'm less experienced with Ruby Gems but I believe they are roughly equivalent to CPAN. – mikera Nov 03 '11 at 00:51
  • @mikera - ruby has "jewels", php has "PECL", Python had the "Vaults of Parnassus" (I think its called the "Cheese Shop" now). C# sharp doesn't have a really well organised package base, but it does come with almost everything you need and if not there are loads of packages and libraries randomly scattered around the WEB. – James Anderson Nov 03 '11 at 06:05
  • 8
    PHP has PEAR. And it's not only a web programming language. – MattBianco Nov 03 '11 at 11:50
  • 25
    I wouldn't say you are a bit biased. You are clearly biased. I can't believe that you can slight Python mainly because it has significant whitespace and because Larry (certainly not an objective source here) used the expression snake oil. And there are no job offers for Ruby at all? When did you last see the job market? At least put some effort in trying to establish Perl's credentials. – Muhammad Alkarouri Nov 03 '11 at 12:42
  • 1
    @JamesAnderson: C#, through Visual Studio, has NuGet ... which is _close enough_. – Bryan Boettcher Nov 03 '11 at 19:19
  • 1
    @MattBianco PHP is a scripting language. Its a mess that was created to just get the job done without caring about types and memory. Threads? Locking? Oh well... – Dalibor Filus Dec 10 '11 at 17:08
  • 6
    -1 for a clearly biased and unresearched perspective on other languages. I agree that Python is snake oil, but Ruby == "script kiddie" is absurd. I have never seen a Ruby-based intrusion attempt on any of the servers I maintain. It's mostly Python. PHP is an acceptable programming language in any sense? Shenanigans. Your comments on C# demonstrate an astounding naiveté regarding typing and/or object-orientation. Stick to Perl, buddy. Seriously, I will always love Perl because it was my first 'real' programming language, and is brilliant for sysadmin tasks, but this answer is worse than bad. – Jason Lewis Jan 14 '12 at 08:51
  • 8
    +1 For dis-ing every language I have ever loved (or hated)--excepting Perl, of course. :-) – jpaugh May 17 '12 at 05:32
  • 3
    ruby **does** have it's own CPAN – shabunc Aug 21 '12 at 10:48
  • CPAN is just snake oil. – Kevin Oct 29 '12 at 15:10
  • 1
    "You're not going to find "Ruby" as a requirement in job offers any time soon (if ever).": Not true. There are a lot of Ruby job offers around. – Giorgio Dec 07 '12 at 12:16
  • 1
    I laughed a bunch at these, especially because they closely mirror some of my own gripes at times, but that's just what they were, a momentary gripe. I do sometimes chafe under the whole notion of significant white space in Python, but PHP does have PEAR, and Ruby has RubyForge with several thousand projects...the thing that made me laugh was about C# bitching about things needing to be cast. Which version are you using amte? The latest version is so much more flexible, with anonymous types, templates, covariance/contravariance, the var keyword, etc. – Maurice Reeves Dec 28 '12 at 16:31
  • I would say Ruby has the most job offers among Ruby, Perl and Python, just after PHP. And almost all languages have similar tools like CPAN, like Pear for Python and Gem for Ruby. – SwiftMango Apr 14 '13 at 19:59
  • You've got everything wrong with Python. It doesn't care about whitespace to be "easy" in new developers, but because it forces code style standards (both up and downsides). Python doesn't have CPAN, it got something even better and has for years; Python Package Indexer (PyPi), with a full package etc. – timss May 20 '13 at 14:51
12

Performance is one of the major reasons to opt for perl. Compared with Python, Ruby or any of the JVM based scripting languages its lightning fast.

This is why its never been replaced in the data mining space, all the other (freebie) languages are slower when it comes to handling large volumes of data.

James Anderson
  • 18,049
  • 1
  • 42
  • 72
  • 6
    Can you provide support/benchmarks for this assertion? IT seems to me the last benchmarks I have seen for Perl vs. Ruby/Python favored the latter, esp. when including alternative implementations of the latter. – Jason Lewis Jan 14 '12 at 08:33
  • 2
    Any remarks about performance must be a generalization unless specific releases and environments are quoted. Many bench marks out there - http://hentenaar.com/serendipity/index.php?/archives/27-Benchmark-PHP-vs.-Python-vs.-Perl-vs.-Ruby.html http://onlyjob.blogspot.com/2011/03/perl5-python-ruby-php-c-c-lua-tcl.html are pretty typical. You are right the latest versions of ruby are pretty fast, but, perl has regular "performance enhancement" releases so should have no problem keeping up. LUA beats everything. – James Anderson Jan 16 '12 at 02:01
  • Lua is pretty blazing. – Jason Lewis Jan 16 '12 at 02:35
12

I was attracted to Python by its layout - the block structure is "what you see is what you get" - and don't understand why there are people who are put off by this. I think it was, and is, a good idea.

I went back to Perl, though. It just seems better thought out as a practical tool. In computer-science theory, Python and Ruby are "better". But I work in the real world.

Ruby and Python are more fashionable among kids fresh out of college. Most programmers who are on Facebook will follow the current fashion and go with Ruby or Python. The original post illustrates this: it conflates "Is it worthwhile" with "Is it still popular?"

I neither know nor care whether Perl is "popular" in a Facebook world. It is probably the most widely used scripting language among people who accomplish a lot, which is a very different thing. Some of the commenters who think that their favorite language has a comparable resource to CPAN have no idea about how broad and deep CPAN is.

user83421
  • 131
  • 1
  • 3
  • 5
    Significant whitespace is a terrible idea. Always was, always will be. That being said, although I use Ruby anywhere it makes sense, I still have a few Perl scripts for sysadmin tasks that I've had no reason to rewrite in Ruby. Why? They work just fine, and they're in Perl's sweet spot. Why create more work? – Jason Lewis Jan 14 '12 at 08:57
  • 1
    Forcing people to indent correctly is a good idea regardless of language. Better languages (like Python) merely apply more force. – Brendan Jan 15 '14 at 14:04
10

Perl is THE language to write disposable tools. There are various other applications where Perl is more or less persistent and useful, but if you lack a shell command to do an odd thing, if you need a stub to grab some data from an odd socket, if you have a log file or a database and need to extract some content in a way that is outside of reach of SQL, if you need to pull a couple images from the server, or if your webpage templates all contain the same type of mistake and want to fix them all - whipping out a 10-minute Perl script is the way to go.

Writing the same thing in Shell would be likely possible but due to weird caveats of shell syntax, it will take longer and can be much harder. Writing this in any "professional" language like C++, C#, Java etc will take roughly a hour by comparison. Writing this in a competing scripting language like Python, Ruby or PHP is a viable alternative and will likely take up to 20% longer to write.

Yes, programs in other languages will be more maintainable and easier to read. But if you need a solution NOW, Perl is the way to go.

SF.
  • 5,078
  • 2
  • 24
  • 36
8

Check out the "recent uploads to CPAN"-page. There are >20 new modules or updated modules being uploaded every day. I think the average number of daily uploads has been slowly but steadily increasing. Is this actvity a sign of a language that is dying? No!

It always impresses me how some important modules (for web programming for instance, or interfaces to RDBMS drivers) have been maintained and refined over many years. Often by the original author, or by new maintainers. Often this has created very mature code.

To get a module into CPAN authors are encouraged to go a very long way to maintain backward compatibility (with older perl 5 versions) as well as platform independence. See for instance http://matrix.cpantesters.org/?dist=DBI (DBI = database interface, abstraction layer)

Also the language itself: I am a bit puzzled by all the new features that have been included into the language since 5.10, 5,12., 5.14. I have not learned to take advantage of the new features. Perl has been evolving too fast for me!

knb
  • 747
  • 1
  • 8
  • 16
7

I learned Perl 4 and 5 while doing system administration back in the 90'es. Today I do Java programming (where invoking Perl is usually not desirable), and I still use Perl once in a while on my development computer. This is usually solely to do datamining on log files where the regular expressions in Perl and the scaffolding for text parsing oneliners in Perl make it very easy to do on a command line.

Essentially I use it today as awk on steroids. For this it is brilliant.

One of the features of Perl is that there is more than one way to do almost everything. This allows you to choose the one that fits with your way of thinking - which is great when just hacking together a oneliner or two, but not so great when having to understand other peoples Perl code as they usually choose some other way to do it which fits with their way of thinking.

I would consider Perl a very useful tool which you may want to learn if you focus on just what the regular expressions can do to help you sift through your text files. Stay away from anything to do with objects.

  • So you'd say its mostly useful for quick scripts to handle text? – Bob Oct 24 '11 at 03:08
  • In my opinion yes, then it is really, really good. It CAN do other things too, but those are not as well baked. –  Oct 24 '11 at 05:54
  • 1
    While Perl is very good at handling text through its regular expressions, there is no need to go through it if you know Python or Ruby (or maybe PHP), I would say, since they are also very good with regular expressions. Python is a little more verbose, though, but it is also certainly cleaner. – Eric O. Lebigot Oct 24 '11 at 08:33
  • @EOL, but neither Python nor Ruby nor PHP can top the scaffolding for text parsing oneliners. See e.g. the "-i" option. –  Oct 24 '11 at 11:05
  • @ThorbjørnRavnAndersen: Agreed, for one liners: Python's oneliners (-c option) are indeed longer. :) – Eric O. Lebigot Oct 24 '11 at 13:01
  • @EOL, you are aware that the -i option allows for doing inline editing of a file, saving the old version e.g. as .bak? –  Oct 24 '11 at 13:17
  • @ThorbjørnRavnAndersen: Yep, that's why doing the same thing in Python through the -c option would be longer. :) – Eric O. Lebigot Oct 24 '11 at 13:42
  • I can do damn near anything I used to do with Perl one-liners via Ruby one-liners. I prefere Perl's RE substitution syntax, but since we're talking a difference of about 3-5 chars, not really an issue. – Jason Lewis Jan 14 '12 at 08:54
7

For a while Perl5 development stagnated because of the focus on Perl6 which caused a long delay between the release of 5.8 and 5.10. Since then the community has really started to realize that Perl5 and Perl6 are different languages and there have been very regular new releases recently.

Perl recently won a web app competition using Catalyst (Although I prefer Mojolicious) and some of the new Modern Perl practices bring a lot of cleaner OO ideas to Perl with things like Moose.

In my opinion, as a Perl developer, Perl has a great legacy as well as a bright future not only being the duct-tape that holds corporate networks together but also a place in the new hotness of web applications.

AFresh1
  • 131
  • 3
3

I'm not an expert programmer. But I found Perl quite easy to learn (I used the camel book), always a pleasure, and PerlMonks the friendliest help community in programmingland. Perl does seem to have lost its sex appeal in terms of hiring to Ruby and Python, but only in certain industries (web especially).

3

If you know perl, it's easier to learn Microsoft's Powershell. Regarding powershell's syntax, it does not have perl roots, but Powershell has taken many features and concepts from the language Perl, e.g, off the top of my head: the $_ variable, prefixing arrays with @ and strings/scalar values with $, file conventions for naming and storing modules, and, in some way, Autoloading, to name a few.

So if you know Perl it'll come in handy, and it's a bit easier to learn Powershell, or to grasp the mindset of Powershell, or to keep Powershell idiom in your long term memory. Encountering Powershell without some perl background is probably a bit weirder. Just saying.

Of course the language Powershell added new stuff, in particular its .NET friendlyness, and did not continue any of perl's functions/operators that provide "backward compatibility" with the unix command line tools.

knb
  • 747
  • 1
  • 8
  • 16
2

Grant McLean just uploads a short movie based on evolution of mapofcpan.org, showing the way the CPAN evolves along time with a map-style visual way. It's pretty self-explanatory about the aliveness of the community. Not dying.

Perl is surely suffering of it's bad reputation, because of many legends and because it's community don't want and don't try to make it to be the-hippest-programming-language-in-the-world. It's very difficult to understand why so many people are absolutely convinced that it's an horrible language. You can write creepy code with any language. Perl got best practices as any other language, you just need to implement it int the more than one way to do it base philosophy.

I can see a very sad reason for this bad reputation: for a long time, Perl communities websites got very ugly UI designs (just like perlmonks.org for example). Personally, I really don't care about this, maybe I even come to Perl because for this reason: not a lot of fashionable websites UI, but you can trust the tools, the community with much more faith because it don't tries to be more beautiful than it is. However, quality tools don't mean that you should not focus on the appearance, and it's eventually a kind of mistake to not take care of the look.

For example, a friend of mine (who likes more fashionable languages) told me that the current Perl6 logo is horrific and it will be a problem to attract young flesh to Perl. Much more a problem than with a bright stone or any other well-designed logo.

I believe it's a very sad reason for unpopularity, but that's what rules the world.

smonff
  • 239
  • 1
  • 7
  • If you aren't going to show attention to detail on your logo, why should I assume you're going to show attention to detail in the deeper details of your language? It isn't just that the logo looks bad, it's that the bad logo feels symptomatic of a culture that doesn't value how things are presented, and that reinforces the stereotype behind all the "write only language" jokes – Racheet Jan 15 '14 at 14:54
  • I've heard about people working on the bad reputation. These people are advocacies of modern Perl and test driven development. Websites like http://builtinperl.com, http://questub.io are changing the way we should consider the Perl case. Duck Duck Go is also a huge success, nobody can't say they don't care how things are presented. Even https://metacpan.org has been a way to give to the CPAN user (the main Perl strength) a new experience through displaying code, documentation and search modules with a nice UI. I don't believe in languages logos: does C has a logo? A language is not a brand. – smonff Jan 16 '14 at 02:46
1

Perl is definitely not dying. It has just never been as hyped up as some other languages have been.

While it is true, that Perl itself is an old language, it has a vibrant and very productive community, the value of which is in the CPAN library. I don't think any language has a library as extensive and as comprehensive as CPAN. Nothing even comes close. In CPAN you will find thousands of modules and frameworks, that do just about anything you can imagine. Need a web server? There's HTTP::Server. Need a standalone database? There's Muldis::DB. Whatever your needs happen to be, you will usually find several modules that fulfill your need, you just have to pick the one that fits your app best.

As for Ruby, Python and other competitors, i think healthy competition has been a tremendous benefit to Perl. Anything that other languages got, the Perl community rewrote in Perl. For example, when Ruby was flying on the success of Rails, Perl got Dancer, which is in many ways better then Rails.

Perl is definitely not dead, nor is it dying. There's just nothing flashy going on around it, there's no company, that would benefit from hyping up Perl, so it doesn't get much media attention, and not every kid knows Perl, so there's less talk about it.

It's been more then 6 months since your original post. In case you have still not decided, do yourself a favor and learn Perl.

smonff
  • 239
  • 1
  • 7
Rox
  • 1
  • 1
0

I've been using perl for web game development since the 90s, and after a 3 year break, I agree with the previous poster. I come back and find it's evolved way above and beyond where I left it.

Is it dying? Not a chance.

Is it useful? I'd be lost without it. Maybe that's just me, but from the other responses, I'd say it's a very active living creature.

-6

I got most of my professional web experience with PHP but as I grew as a developer things got a bit more challenging, many tasks PHP simply could not do or does grossly inefficiently. I could have thrown my hands up but instead (thanks to google) I found myself in ssh sessions taking advantage of libreoffice, ffmpeg, imagemagick to write post process functions for PHP. Never using it before I went right for PERL.. mostly because Perl sits perfectly underneath the LAMP stack.

(1)it is preinstalled on all LAMP servers or at least has a fresh rpm. (2)has an awesome CPAN repo to save you lots of time. (3)faster/safer to perform tasks where PHP running on apache fails. (4)very similar to PHP and easy to learn.

Mix ideas with PHP, bake with PERL using BASH as desired, flip according to MySQL then serve up with HTML5 and a dash of jQuery. Its a great recipe.

EDJ
  • 1