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!

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
If this question can be reworded to fit the rules in the help center, please edit the question.

12

Let's not lose perspective, according to TIOBE it's still in the top ten, ahead of Ruby and even JavaScript.
–
DanielOct 24 '11 at 20:23

8

@Daniel Yes, TIOBE is such a valid indicator of a language's usefulness.
–
Jason LewisJan 14 '12 at 9:16

3

@JasonLewis Can you propose a better source?
–
tehnyitMar 14 '12 at 21:43

1

@tehnyit: I'm not sure "better" is the right adjective (being a variant of "good", but LangPop.com is at least a less bad source.
–
Jerry CoffinApr 19 '12 at 4:36

4

Anecdote: 10 years ago at conferences, the jokes were all about COBOL. Now they're about Perl.
–
Mark JohnsonJul 8 '12 at 2:41

19 Answers
19

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.

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.

Ruby is Candy Coated Perl, just as Macs are Candy Coated UNIX, the two are attached respectively to each other.
–
World Engineer♦Oct 24 '11 at 0:42

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.
–
ZJROct 24 '11 at 1: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 SherohmanOct 24 '11 at 10:29

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"
–
ZJRMar 8 '12 at 23:36

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
–
EarlzOct 29 '12 at 13:56

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.

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.

@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.
–
ldigasOct 23 '11 at 23:39

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 TomblinOct 24 '11 at 0:19

7

If I were starting now, I'd probably use Python. But I use Perl because I'm good in Perl.
–
Paul TomblinOct 24 '11 at 0:36

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.

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.

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)?
–
BobOct 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.
–
blundersDec 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 LewisJan 14 '12 at 9:04

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.

-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.
–
mikeraNov 3 '11 at 0:51

8

PHP has PEAR. And it's not only a web programming language.
–
MattBiancoNov 3 '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 AlkarouriNov 3 '11 at 12:42

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 LewisJan 14 '12 at 8:51

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 LewisJan 14 '12 at 8:33

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?
–
BobOct 23 '11 at 22:59

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.
–
arnaudOct 23 '11 at 23:13

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 ThornleyOct 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 GrossDec 12 '11 at 17:16

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.

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 LewisJan 14 '12 at 8:57

1

Forcing people to indent correctly is a good idea regardless of language. Better languages (like Python) merely apply more force.
–
BrendanJan 15 '14 at 14:04

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.

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!

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.

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.
–
EOLOct 24 '11 at 8:33

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.

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.

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

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.

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.

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.

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.