Why do people like Perl?

I see lots of people being super happy with Perl, but I don't understand.
What does make Perl so enjoyable to those people ?
I mean, there isn't even arguments to functions

Did you find this post useful? Show some love!

Many people dislike Perl and like their competitors (especially Python) because it is so flexible. They prefer a language to rigidly enforce certain paradigms. As a corollary to that precept they also tend to only use core language functionality, because this tends toward consistency with other users of that language.

Perl on the other hand values flexibility, often allowing several ways to accomplish the same task. The user is encouraged to model the problem in the way they like to think about it, not in the way that the language (or more explicitly the language designer) wants you to think about it. This will often mean that in order to completely understand the code written by someone else you will need to have a firm grasp of the language since they may choose to use some other functionality than is your preferred mechanism.

Neither of these is wrong however they are very different.

Given that mentality of Perl, the core language often is sparse around high level features. A newcomer will come to Perl and be surprised at the lack of subroutine signatures or object oriented programming sugar. Both appear to be quite low level. An experience Perl programmer however will know that the core is spartan to allow the users to come up with their solutions to the problem and share them on CPAN, and we have.

I see even on this very thread a comment both about how Perl's CPAN is huge and second to none, and then a retort linking to a site that tracks the number of modules available by language. While I would never say that all the modules on CPAN are top notch, I think a much higher percentage are than in those other languages with skyrocketing numbers of modules available. Perl users prototype their language on CPAN. Core Perl is considering adding signatures to functions natively, there is an experimental implementation, and yet some of the sticking points center on how to support the favor features of several different systems available on CPAN. In the meantime users continue to use those CPAN modules that think like they do.

There are many high quality modules that do signatures or OO. In fact we are quite proud of our OO systems on CPAN. Moose and its derivatives (see Moo are incredibly powerful declarative object systems, the envy of anyone who takes the time to understand them. You might be surprised by what is possible: see for example Moops or Dios.

Being able to hack together a quick solution in Perl is just pure joy to me! While I haven't used Perl for any big, long-term software projects -- it probably wouldn't be my language of choice for these purposes -- I believe there is great value in having such a tool for quick-n-dirty scripts that you might only need temporarily, e.g. for test data creation. In that sense, Perl can be the most efficient language IMHO. Plus, I still think that it provides the best experience when working with regular expressions.

Perl gave a birth to languages like python and ruby.
Perl brought into the development process many brilliant ideas.
And, after all, the most weird thing is there are people who can code in Javascript, which is a natural disaster.

Python is almost entirely contemporary with Perl. First versions of Python were being dev'd in 1989 Perl in like 1987.

Ben Halpern DEV.TO FOUNDER

Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)

Please consider creating an account on dev.to. It literally takes a few seconds and we'd appreciate the support so much. ❤️

Plus, no fake comments when you're signed in. 🙃

While I was at university - so about 20 years ago now - I did a fair amount of Perl. Perl was the scripting language, to the point where if you said you were writing a script, it was taken as read that you meant Perl. It was great at hacking out quick and often dirty solutions to problems. It was the language of choice of the sysadmin. Yet even then, it was well known as a "write-only" language, and generally looked down upon by "real" programmers.

But for sysadmins, it was awesome. Don't compare it to Python, or C++, though - compare it to Bash, Awk, and Sed. These were its progenitors, not C. And it beat them hollow. It was written as, and excels as, a glue language.

Perl programmers went in two directions. Some, like me, drifted onto other language choices, as things like Python grew to handle some of the space Perl occupied, and Bash itself grew better. Sysadmins turned into DevOps and got tooling like Ansible and so on.

Others focussed on trying to modernise the language with ever more modules in CPAN, and ever more language features built on the byzantine nest of references and blessings that makes up Perl.

Love this answer! It's worth noting that Ruby stole enough from Perl, that most of what people would use Perl to script, Ruby does just as well.

They like it because it is comfortable to them; they have learned to use it and know they can solve problems with it. They have the tools handy, they are familiar with the libraries and can get going quickly on any project using it.

It has to do with confirmation bias and normalcy bias. You tend to stick with what you know, appreciate and defend stuff you invested a bunch of time on, and resist change.

With every language under the sun, you'll find a range of emotions going from blind love to absolute hatred. It's like for all technologies. Some people love PCs, others hate them. Some people love iPhones, others prefer Android. The debate is almost pointless, as it has to do with emotions and personal attachment more than anything else.

It has been a while since I did any real work in Perl, but there is one thing I really miss in (most?) other languages. That is regular expressions built right into the core of the language.

As a regular Perl coder I can say that Lorenzo pretty much covered the reasons.
One other that I can add is run time speed. I can write a perl program that can process data bases and 100's of files in a lot less time than Python or ruby

I enjoy software development and coding. I don't enjoy perl nor do I hate it.
I think there are a lot people that hate perl that have never really used it.
It is very easy to write crappy unmaintainable code using perl because it has an operator dense
flexible coding system. Python and Ruby have built in code conventions that can herd a coder down one path. If the path is one you would take all is well and right. Some of us are just rebels at heart. Also there are some tasks for which it's just better to take a side trip down Ruby or Python's one path. Perl will let you go there.

I encourage you to learn Perl. It very possible to write good code in Perl. Whatever language you use, write programs. Never scripts, the biggest problem with so called scripting languages: bash, Perl, Python is that so many people believe that their simple throw away things so they jam them out quickly with cut 'n paste and not as much thought

Give this read in your spare time modernperlbooks.com/books/modern_p...

I like Perl, well I truely love it!

while this love can be a matter of abitude I never found, in ~20 years, a motivation to leave it or to use something else to accomplish my tasks.

One of first Perl's motto it's still valid and explains much of this love:

Making Easy Things Easy and Hard Things Possible

This is damn true! when you know Perl you can vary from oneliners to complex applications using many modules, classes and and obejects.

While Perl is no more the top laguage that was around 2000, it's vitality was not affected: many new projects gave new fresh blood to it: PSGI/Plack for the web dev part with frameworks like Mojolicious and Dancer2 to build modern web appliations, a major release each year in last 7 years: see them with the sisters realeses of strawberryperl rich distros for Win32 systems.

ModernPerl book it's a fresh look to the language.

Among new projects I'd like to add MCE Many-Core Engine for Perl abrstracting parallelization and bringing it to Linux, MacOS and windows: want you to run your perl on 200 cores? You can!

Some more features that make me love Perl are:

  1. Perl is extremely expressive with a very high signal/noise ratio
  2. CPAN ~200.000 modules at your disposal
  3. a woderful and qualified community: ask at perlmonks if you have a simple or a complex question
  4. Perl it's a glue language and run everywhere. P stands for practical
  5. Perl made a big effort to support unicode: you have to work around it but it's not a Perl problem: unicode it's difficult itself
  6. best regex implementation you can find: extended in recent releases to bring to you an incredible power
  7. with Perl you get your job done, quickly and Perl does not force you to write code in it's manner: choice your style: TMTOWTDI
  8. Perl has a full featured testing ecosystem
  9. it has a wonderful error reporting system
  10. Perl is fun! If you want you can introspect the language itself playing black magic with the symbol table, 'eval' puts the compiler at your disposal at runtime, perl has obfusacations, oneliners, golf and poetry if you want to have fun

See also this post on perlmonks to see other opinions.

L*

use feature qw{ signatures } ;
no warnings qw{ experimental::signatures } ;

sub shorten ( $string ) {
    $string =~ s{(https?://\S+)}{ makeashorterlink( $1 ) }gmixe ;
    return $string ;
    }

But really, once you internalize it, is there really much difference between that and this?

sub shorten {
    my $string = shift @_ ;
    $string =~ s{(https?://\S+)}{ makeashorterlink( $1 ) }gmixe ;
    return $string ;
    }

I recall that in C, you can have it so that you have separate functions for shorten(), shorten(string), shorten(integer), shorten(string,string,string), etc., but that's striking me as a huge violation of DRY. I'm willing to be schooled on the point, though.

There is much to like about Joel Berger's response. I know Joel, and I like Joel. But then, I know Perl and I like Perl. B)

There's also something to Lorenzo Pasqualis' answer.

My coding journey started with C and C++, but as a student employee working with web, it struck me that writing string manipulation code in C was a nightmare, and when I started learning Perl, I saw it as godsend for the tasks at hand.

Beyond that, from the beginning, it fit my brain. I could write pseudocode for a problem and Perl could usually run it. And since then, for fun and for work, I have spent years writing Perl that fits my brain and learning things that make my brain fit Perl.

(I really think that the idea most people have of Perl is based on Matt's Script Archive. With the introduction of Modern Perl, Higher-Order Perl, perltidy and Perl::Critic, the standard for Perl has gotten better since the 1990s, but even by the standards of 1990s, Matt's Script Archive had really bad Perl code.)

With Perl, you get CPAN, which is an incredible source of pre-invented wheel, with the option to use or ignore as necessary. For example, there are quite a number of ways to get CLI arguments in Perl, but it's rare that Getopt::Long doesn't do everything I need.

To contrast, there exists Text::Levenshtein to tell the distance between add and zdd (useful to suggest changes if you accidentally type git zdd README.md) but an independent implementation exists in perlbrew, where they assume you don't have the module and you don't have admin privileges.

I can't say there's nothing I'd want to do that I can't do in Perl, but where I can't, it's either far outside the niche where Perl lives -- Windows is doable, mostly, I think Android is theoretically possible and inside the browser would be weird -- or I just haven't learned enough to make it work. All my interaction with the FitBit API had been with Python, and once they moved to OAuth2, I haven't been able to make anything work.

| What does make Perl so enjoyable to those people ?

If you ask this question to N people, you will get N answers (protip: this applies to most things).

| There isn't even arguments to functions

Not true. It's just packaged differently.

Like others have pointed out, more modern languages like Python and Ruby got to learn from Perl's design and "mistakes"

Compared to other languages, Perl is old (aka 'mature' aka 'crusty' depending on your attitude).

What that translates to is:

  • Supports many methodologies. You can just script or you can build a complex OO package.
  • Many, many packages. Python and Javascript may have an explosion of new packages, but they're all playing catch-up with Perl
  • Ubiquity. It's on and runs nearly every machine.

Sure the language has warts, it's as old as I am!

I'd highly recommend the book "Learning Pearl". It really gives a solid introduction to the language. Granted Perl is pretty unreadable at first, but so is {C, Objective-C, Haskel} until you learn {C, Objective-C, Haskel}.

Quick note on "many, many packages": by what metric are you gauging this?

Also, my favorite Perl book is the "Perl Cookbook" - definitely not for learning from scratch, however.

interesting that it counts distributions, rather than modules... 35,933 vs 194,343, which would have it put on par with Java. I hate statistics and numbers, they somewhat tend to tell you a lie all the time

"There isn't even arguments to functions". This is so wrong in so many dimensions.

What I meant was that, by default, you don't have signatures to functions, only the @_ array

Last I checked, neither does standard JavaScript, but that’s not held it back.

I write a lot of Java these days, but I still write some Perl (and, depending upon the problem to be solved, and the situation in which it needs to run, shell scripts and PHP) and some JavaScript too.

Picking the right language for the task at hand is something you learn with experience, IMHO.

Many scripting languages don't. Most Python projects use **kwargs to not have to enforce specific function arguments.

Perl is multi-paradigm (functional, OO, procedural), high level, extremely fast for a dynamic language, has the lowest defect density and the best Unicode support of all high level languages, ample and helpful community and subcommunities, has the CPAN, and most importantly: Perl lets one code the way one thinks; adopting any approach with the rigor or sloppiness a task merits. This level of comfort and ease might explain why Perl is sometimes reported to have the happiest users. I count myself among them.

As Dave has written, Perl fits my brain. Its data structures, the way how it goes right into the middle of things, its mix of procedural, object oriented, and functional ways of expressing yourself - it corresponds to the ways of my thinking. It might be acquired, but I remember the feeling from my fist days with Perl. Moreover, I love the community.

Let my start by telling you all the things I don't like about Perl: Its thread support is rather limited, exceptions are supported but not properly used in the core language, has several features that do not interact well between them or are missdesigned leading to brokenness in corner cases, the DWIM philosophy backfires when you least expect it, and there are probably others I don't quite remember right now.

And yet, Perl is my go-to language in most cases.

Why? because of several reasons:

  1. It suits the way I think. It lets my solve the problem at hand in the way I want without forcing me to do it following some arbitrary paradigm.

  2. It has a rich syntax and that allows one to write concise and idiomatic code. For instance, compare it to Python, in order to manipulate basic objects as arrays, strings, dictionaries, etc. every one of the supporting classes offers you a myriad of methods, every one doing a little different thing, and some of them with several options in order to support all the possible use cases. On the Perl side, you have a rich syntax providing some lower level operations that can be combined to perform the same tasks done by all that Python methods. That approach has both pros (you don't have to memorize a myriad of methods and what they do) and cons (you are using lower level operations, it is not so evident what you are trying to do, the learning curve is harder). As a personal matter, I like Perl way more than the Python one.

  3. It lets you write simpler, easier to understand code (though, that goes in the opposite direction too, it also allows you to write ugly, unnecessarily complex code). Usually, when I write a Perl function, for instance, I would rewrite it several times until I found the way to express what I want to do in the simplest and most clear way. It requires discipline from my side, not letting me just being happy once the code works. In other languages, you have less options, so you end in the middle. There are no so many syntax features you can misuse, but them there are things you can not express in a simple and concise way.

  4. Then, every other language has its own defects. For instance, I can not stand Python scope handling... it is so rather broken!!!, or Java verbosity...

I think Perl has a step learning curve, with several shortcomings you should learn to ignore and/or avoid. But then, once you really learn the language well, and besides all that limitations it is better than the alternatives.

Also, some people find it ugly because of the sigils, the native support for regular expressions, etc. That's very superficial and unimportant. Is like disregarding Lisp because it uses so many parenthesis.

In any case, in my opinion every person has its own ways of thinking and the best language is the one that best fits such ways of thinking. So, it is largely a personal matter.

We do people feel the need to make troll posts about languages they've probably never touched? I like it because it's easy to read at a quick glance (I love sigils) but you can also use it to compete in code golf competitions. It's easy to quickly run and comes with most OSs. It processes huge volumes of data very quickly, and that's what I use it for in my job. String manipulation is still blazing fast, and its flexibility is second to none.

I used to code amost exclusively in Perl, primarily because of CPAN. You could find anything on CPAN. Now I use almost exclusively Python, because Raspberry Pi, and you can find almost anything with Google on Pip or Stack Exchange or ...

I wrote and published WiringPi::API and RPi::WiringPi specifically so myself and others can use their favourite language (Perl) on the Raspberry Pi.

At work I code in Python, but Perl has, and always will be my favourite language.

For me it's the ability to write code that reads more like prose.

It's a language that lets me express my ideas as I want to.

Coming from a background in C, AWK, ksh (and other languages), Perl was immediately comfortable for me. I learned Perl and (mostly) completed a complex programming project in 3 months as my first assignment at a new job. (There was some "polishing" and tweaking to do after the first release, thus why "mostly".)

Perl's flexibility makes it much easier for me to test my ideas with code. Once I've refined an idea enough, I can quickly produce a proper implementation - even including a basic GUI, when that's needed.

Yes, it does have some annoying quirks, but less so to me, than several other languages I've worked with.

Perl helps me with the secondary tasks that support my primary work (in C). It allows me to work the way I think, so increases my productivity.

I always loved computers, tried hacking QBasic games on my dad's old IBM clone, so when I was in my early teens I decided to try to learn Perl. I got one of those "mastery in 24 hours"-type books from the library, and I remember crying because I'd "never be a real programmer." Nothing made any sense. Since then I kept trying, kept learning, batch scripts, C++, html/case/JavaScript, added ColdFusion, then PHP, BASH scripts, Python, Ruby, Node. Recently I tried again to learn Perl, it's infinitely easier now that I have a stronger grasp of programming concepts. CPAN is a fantastic precursor to PIP, NPM, Yarn - following the Hacker Ethos developed at MIT & Standard, sharing well developed code between hackers to keep making improvements and make programming easier. Without Perl some of these later languages would've never been made. (*cough*PHP*cough*) I've enjoyed finally picking up from my earlier failure.

PS. Arguments are passed to Perl functions in arrays you have to unpack, sure it's a little different, but each language has its quirks.

People being super happy with Perl? That must be Perl 6. ;-)

It's relatively simple, similar to other languages so learning was easy (when I did it 25 years) and it's simply a very fast way of fulfilling your data processing or web needs.

Classic DEV Post from Apr 16

How to begin a project with just an idea

Hi, I have an idea of an application, I'm excited about it, I'm a junior, I'm g...

READ POST
Follow @mshwf to see more of their posts in your feed.
dev.to is now open source!
View Announcement Post View GitHub Repo
Doshirae
Member since Jun 5, 2017
Trending on dev.to
What are common myths about software careers?
#discuss #career
Dev.To Discord Channel?
#discuss
What productivity tools/hacks do you find most effective for your day-to-day?
#discuss #productivity
How Do You Really Get Hired?
#careers #beginners #discuss
SHE CAN CODE!
#womenintech #beginners #career #discuss
5 Things I Wish I Could Tell My Past Self
#beginners #career
I used money as a “value” metric
#career
Being average in > 1 things is easier and more valuable than being excellent at 1 thing.
#career #learning