
Why I still love Perl - Ovid
http://allisonrandal.com/2013/03/31/mythbusters-why-i-still-love-perl/
======
papaf
Last year I needed to do a small project to run on a web server with only
Apache available. Rather than go to the pain of requesting some new web stack
installed I wrote a single CGI script in perl 5 - just as I used to many years
ago.

I did it the old-school way with no fancy framework, just CGI.pm. I made fun
of myself to my collegues saying it was great to live in the 90s again. But
actually, after a few hours coding it became clear that we haven't progressed
very far.

It was a single script and it just worked. It was also much more fun than
persuading a web framework to do what I wanted because I was actually
programming and not configuring.

~~~
jrabone
It's a similar experience in Java-land when you throw out the frameworks and
all the servlet container bullshit and just start up an embedded Jetty. It's
easy, lightweight, fast, you can do anything you want without crapping out
mountains of XML configuration, or layer upon layer upon layer of
introspecting, byte-code engineering, dynamic code-rewriting-where-the-hell-
did-THIS-code-come-from annotations. You have control, in the place where it
matters - the source code. You can write end-to-end tests that developers will
actually run, because they don't need to spin up JBoss for 5 minutes before
they're ready to go.

Frameworks have got a lot to answer for; it's very rare that a large project
actually gets to use the flexibility that a modern framework provides. Who the
hell actually swaps out their ORM or their database for a different one in a
production system? Sure, the lead architect was sold on the idea that they
wouldn't be tied to a particular implementation, but when the shit hits the
fan the business will deem it "too risky - find another solution".

Thus we advance to the third level of professional software development, the
Sarcophagus model - wherein it's simply too risky to actually CHANGE any part
of a (now-legacy) production system, but we CAN build a sarcophagus around the
toxic core such that no more careers need be sacrificed to trying to maintain
it. I have some great examples of this, but professionalism forbids me from
relating them. Perhaps when I finally decide that keeping sheep on a remote
island is preferable to being a software "engineer", I'll start writing about
them.

~~~
Ingon
So right. Just spin the damn jetty, put the postgre driver and off you go.
Most of the infrastructure is done in a day or two, and if not enough you can
always revisit it later. And it runs fast. So fast that it feels like dynamic
language. And even with the modern apps, where most of the action is on the
client (and the server is interface to the DB most of the time) you even don't
need to restart your server that often.

I think that whoever says that Java is not good language for development
either have seen only j2ee or never did looked around. (as a prime example the
stupid bean convention and tools which operate on it)

~~~
kbenson
I know _my_ reason for not wanting to develop in Java is that since for the
most part the speed difference doesn't matter for my needs, it boils down to
how easily I can transcribe/translate my concepts into code.

The conceptual impedance of Java is just higher for me. I think most of the
code I write (the non-algorithm complex stuff) that boils down to stuff like
"take the subset of the collection of orders with a total over 100, and sort
by number of items." In Perl, that may be as simple as:

    
    
        my @large_orders = sort { $a->{items} <=> $b->{items} } grep { $_->{total} } @orders;
    

I think allowing me to express myself easily and succinctly like this saves
time, reduces errors and allows me to concentrate my time and attention on the
more complex portions of the code.

I also think succinctness (where idiomatic for the language, so it's not
confusing) is useful in it's own right. The more of the current (or related)
function and program state that's obvious on the screen when I'm coding, the
less likely I am to have to break off from what I'm doing to go look up a
detail I need.

~~~
zimpenfish
Not a great advert for Perl, that, since it doesn't implement the quoted
action correctly...

~~~
prakashk
Because `> 100` is missing from the condition? Other than an example of poor
copy-pasting of code, how do you conclude that it is "[n]ot a great advert for
Perl"?

For the record, this would be the code with missing part included:

    
    
        my @large_orders = sort { $a->{items} <=> $b->{items} } grep { $_->{total} > 100 } @orders;

~~~
zimpenfish
It might lead someone to conclude that Perl users were slapdash in their
approach and prone to tossing off untested code. Possibly unreasonably,
possibly not.

------
jamespitts
Fantastic "hey, perl is not dead" article, and read it just as I was hunkering
down to do some AWS automation with perl.

What has always impressed me is the consistency and quality of the
documentation of most CPAN modules. There's a huge group of people working at
improving perl infrastructure and they don't get half the credit that they
deserve!

Some examples:

<http://search.cpan.org/dist/DBI/DBI.pm>

<http://search.cpan.org/~mlehmann/AnyEvent/lib/AnyEvent.pm>

<http://search.cpan.org/~melo/Redis/lib/Redis.pm>

<http://search.cpan.org/~abw/Template-Toolkit/>

<http://search.cpan.org/~ether/Moose/>

It is just ridiculous. Searching around CPAN can become an odyssey.

~~~
phaylon
Just wanted to ask if you know about MetaCPAN[1]? It has a nice list of
modules people "upvoted"[2] :)

[1] <https://metacpan.org/> [2] <https://metacpan.org/favorite/leaderboard>

~~~
jamespitts
Yeah, metacpan is a killer interface to CPAN. But it really comes down to the
efforts of the individual module maintainers to create all of that great
documentation.

------
ceautery
It's still difficult to beat perl in a production Unix environment to fix a
hot issue, especially if you know your way around regular expressions. When I
hear comments like "now you have two problems", or "it's harder to read than
to write", or references to the P in LAMP being Python or PHP, I chuckle to
myself.

Here's an example of how I use perl, off the cuff, in day to day production
life: <http://cautery.blogspot.com/2010/09/concise-perl.html>

~~~
Falling3
>It's still difficult to beat perl in a production Unix environment to fix a
hot issue, especially if you know your way around regular expressions.

That may have been true at one point, but what advantage does Perl now have to
any number of other languages with great RegEx support?

~~~
kbenson
First, it's not just just good regex support, it's easily accessible features
from the command line so you can quickly iterate to a solution.

I'll often need to pull some very specific information out of a very large log
file, and often Perl is the quickest way to achieve that. i.e.

    
    
        # pseudo-code
        head -n10000 LARGE_FILE | perl -ne 'next unless my ($foo,$bar) = /include/gsmi; ${foo}+=$foo, $h{$bar}.=$bar}; END { print %h }'
    

Once you're happy with results on smaller data sets with head, replace with
cat. I used a similar technique to _quickly_ identify, classify and determine
the user account for a large set of hacked Wordpress accounts at an ISP I
worked for.

Secondly, Perl is still the leader in regex development. They are still adding
features that other languages are adopting (there have been a few good ides
from outside they've taken as well, such as named captures, so credit where
it's due).

------
nemothekid
I've never really had a problem with perl until I had to mange fairly large
projects - including things like web frameworks or distributed modules.

Perl works best as CPAN glue. CPAN is wizards handbook, and you just have to
write maybe 100 lines of code to glue everything together. However when it
came time to write a large project on a team of even 2 or 3 people, managing a
Perl project seems to turn into manager a C project. The "Theres more than one
way to do it" mantra really sucks for people who learned Perl in differently.
00's university perl doesn't mix well with 90's hacker perl.

My huge problem with Perl is readability. Sometimes, across teams, there are
just too many ways of doing some simple thing and one is plain perl code to
one person, is a 5-minute and stare at this line hack to another.

Am I wrong? My experience is limited, but I would love to know why I haven't
been able to get my Perl projects to "sync".

~~~
qntm
The "There's more than one way to do it" sucks for trying to teach Perl too.
You can't just teach one way; you need to teach every way, so that students
can understand what they're seeing in the wild. This makes it take three times
as long to explain the basics of Perl, simply because there are, essentially,
three times as many basics.

~~~
chromatic
My experience is different. I spent a lot of time in the beginning teaching
the three or four important theoretical parts of Perl (lists, context,
monomorphic operators, and coercion) and then explained how to use the
documentation. That leaves only a couple of places where the difference
between approaches is substantial enough that it needs explaining.
Dereferencing syntax is one such wart. Choosing an object system used to be
another place where opinions varied enough that it mattered, but now teaching
Moose by default is obviously enough correct that it's a boring choice.

~~~
adrianhoward
Yup. I've not taught perl for a while - but that pretty much matches my
experiences. The N ways of doing "good" OO was the biggest problem I
encountered and Moose solves that.

------
asimjalis
Perl still leads the pack on indeed.com. And I keep getting requests for Perl
training. It is always interesting to see the disconnect between what is
popular with programmers, and what is actually popular in the industry.

~~~
zorbo
Interesting. When I do some searches on the Dutch version of Indeed.com, I get
very different results: Perl (421 hits), PHP (2397 hits), Python (493 hits),
Java (3173 hits). The top of the Perl listings seem to be for system
administrators, and are not a required skill. Contrasting that to PHP, where
the top are all specifically asking for PHP.

I personally haven't spotted Perl in the wild as a serious programming
language for a long time. Again, it seems Perl is mostly popular with system
administrators without much programming experience. But that might very well
be just my little corner of the world, which happens to be a hosting company.

~~~
adrianhoward
Oh it's definitely still out there. Still used a lot in the finance sector in
places. A bunch of companies have a stack of perl infrastructure that "just
works" and want to keep it that way. Still folk starting new projects with it
(Duck Duck Go, Bunchmail, etc.).

As many as PHP, Ruby, Python, etc. - maybe not. But new projects are still
rolling out.

------
arc_of_descent
I've been trying to learn Perl 6 for a long time now. The PDF book is great
but nothing beats a paperback style novel you can read anywhere. I got hooked
onto Perl (long time back!) after reading the Programming Perl book (Camel
book). IMO Perl 6 seriously needs a book release. No e-book, PDF, etc. just a
old style paperback!

~~~
PommeDeTerre
Perl 6 needs a production-grade implementation before it needs a paper book
release.

------
zoul
Note that the suggestion to release the next version of Perl 5 as Perl 7 is a
part of a wider discussion the Perl folks are having about branding:

<http://shadow.cat/blog/matt-s-trout/names-and-numbers/>

Plus many more posts by Matt, chromatic, David Golden, and Ovid.

------
freyfogle
Anyone looking to work in perl (no need to be an expert, we'll teach you) and
see why it is often the best tool for the job, and in a start-up environment
in London, we're hiring: <http://www.lokku.com/jobs/perl-developer-2013.html>

------
fingerprinter
My first language was C. The first language I loved was Perl.

Perl will always hold a special place in my heart and I will look back on it
as the "good ole days", but I don't know if I'll ever program in it again.

~~~
kbenson
I'm curious as to why? Do you think it's deficient compared to what you
currently use to fulfill that niche, or do you have other reasons?

~~~
zoul
For me, I don’t feel comfortable working without a static type system. I love
Perl (and initially mistyped that as “live” Perl, which is nice), but nothing
beats the feeling of the compiler going through the code for me. Granted, I
still have the test suite, but that’s much more work than just getting the
types right.

~~~
kbenson
I'll agree with that. There's numerous times I've wanted to be able to assume
(correctly) that a scalar holds a certain value type. At the same time, it
sometimes feels constraining to design within that limitation. I think
optional typing is the future here, and Perl 6 has it, as well as a few other
modern languages.

------
jamespitts
Here's some of the discussion about the "island hop" from perl5 to perl7:

<http://blogs.perl.org/users/ovid/2013/02/perl-7.html>

------
moreentropy
So what exactly is her point?

~~~
Legion
That's a fair question. The title is "Why I (still) Love Perl", but the post
doesn't really seem to get around to explaining that.

It's not really a "Why you should use Perl instead of X" either.

It seems more like, "Perl's Not Dead, It's Just Schizophrenic Now". It attacks
the idea of "Perl is Dead" with a description of the rather confusing state of
"modern Perl". It doesn't exactly make the ecosystem sound all that enticing,
not here in 2013 when there are so many other viable options.

~~~
tete
Well, in my opinion the article says Perl (5) isn't Rakudo (Perl 6) and
therfor one should have a look at the thirteen years of Perl 6 development,
but the Perl 5.x series, when wanting to learn about Perl?

I think the "Why I love Perl" part is pointed out by the community and that
Perl 5 basically spawned Perl 6, which is a different programming language.

I pretty much agree that Perl 5's popularity is really low, despite lots of
great minds and exciting approaches. I switched to Node.js, CoffeeScript, Go,
etc., but it is like everything I do could have been better or equally done in
Perl and the tools were more mature. It's the same with all the new concepts
and always makes me think about the MVC hype, when the concept of MVC was
first named in the 70ies. It's a bit like with Smalltalk. It took like 30
years until people ralizing how good it is and reinventing it.

Same with "Do things the Unix way", pipes, KISS, NoSQL, distributed systems,
all the stuff that the EC2 made popular. In that sense Computer Science is a
really slowly developing science. At least it appears like that, maybe others
are similar. I don't know.

And what is happening right now for example is making Javascript C, while the
developers of C are stepping towards dynamic languages (Go). Also functional
progrogramming laguages reappear, first Haskell, now Clojure reapear, cause it
is cool for async stuff. LISP has been around for ages and Scheme is really
beautiful and neither of them was ever slow or anything. Just look at Racket.
It's pretty powerful, amazing to learn, performs at least okay and its IDE is
pretty nice and cross-platform. It's amazing for doing the same stuff as
Node.js and Scheme is one of the easiest languages to implement.

But back to Perl. It has a lot of problems. Nobody ever talks about how
awesome CPAN and CPAN-Testers is (you don't even need to set up Travis CI).
Nobody ever talks about it as functional programming language, even though
there is a great book about. Another problem is that it is way more optimized
for getting actual problems done and doesn't really perform too well, when you
show your average snippet that looks mostly the same in every programming
language out there.

The last flaw is that Perl is probably the hardest programming language to
learn, because there are so many bad books out there. There are books like
Modern Perl, that even are free, but also many really bad ones.

And a lot don't tell you about use strict; use warnings; use diagnostics;
right away, even when they are what every beginner wants.

~~~
zorlem
That's why I find community initiatives like the Perl Tutorial Hub
(<http://perl-tutorial.org/>) very valuable, especially for people just
starting with the language.

They even have a page dedicated to sifting through tutorials and guides, and
assessing their usefulness for learning Modern Perl - <http://perl-
tutorial.org/learn/>

------
bane
I learned Perl about 15 years ago and, while I love the language, am finding
myself stuck in Perl from those days. Any resources I can go to to get myself
up to speed with modern Perl practices?

~~~
adrianhoward
_I learned Perl about 15 years ago and, while I love the language, am finding
myself stuck in Perl from those days. Any resources I can go to to get myself
up to speed with modern Perl practices?_

I'd recommend chromatic's Modern Perl
(<http://www.onyxneon.com/books/modern_perl/index.html>) and Curtis Poe's
Beginning Perl ([http://www.wrox.com/WileyCDA/WroxTitle/Beginning-
Perl.produc...](http://www.wrox.com/WileyCDA/WroxTitle/Beginning-
Perl.productCd-1118013840.html)) as good places to start.

~~~
prakashk
> Curtis Poe's Beginning Perl

The online (draft) version of Beginning Perl is available at
<http://ofps.oreilly.com/titles/9781118013847/>

------
pasbesoin
Perl was my first love in the programming world. The first one that (or,
"who") _understood me_.

And s/he had some really nice friends. It was always fun, and interesting,
hanging out.

------
nikcub
Perl is like records on vinyl. There are a small group of people who swear it
sounds better, but as a commercial artist you definitely wouldn't release
anything new on it.

~~~
joel_perl_prog
<https://github.com/joeldalley/Soma>

I just spent a couple weekends putting that together. It's just a little toy,
but it does exactly what I want, the way that I want it to.

I have to say I really enjoyed writing it. Specifically, writing it in Perl.

Writing Perl never feels like work to me. Can't say why, exactly. But I do
know if I'd used PHP or Python instead, the pleasure of writing this app (as
opposed to anticipating its completion) wouldn't have been there--I would have
just persevered through it, in order to reach the final result. Totally
different experience.

~~~
bane
_Writing Perl never feels like work to me._

I 100% agree. It feels like having a fun conversation with an old friend. The
kind of old friend you can not see for months, then pick up your last
conversation again without any problem.

I think this really has to do with the language design being guided by
linguistics principals than academic language design ideas.

With very little work, it's possible to write decently maintainable Perl as
well.

------
tomasien
Let's say I don't know any server side language. Why should I learn Perl when
Php is ALWAYS loaded and configured on every single server, was literally
built for MySQL, while Python and Ruby and hotter (and more intuitive) with
better MVC frameworks and libraries behind them, why?

I'm not being facetious, I really want to know the reason I would do that. I
buy the "Perl is better than C" argument 100%, but how is it better than Php,
Ruby, or Python ESPECIALLY for someone picking their first server side
language?

~~~
mst
You might not be being facetious, but you have clearly already decided that
python/ruby have better libraries for whatever definition of "better" you're
using.

Personally, I'd avoid PHP as a first language because it's, well, kind of an
abomination of a language even if the community have done some awesome things
with it.

As for perl/python/ruby? I usually suggest to people that they should write at
least some code in each of the three; you end up as a better programmer as a
result and besides, it's fun :)

~~~
tomasien
I have not at all made a decision, I'm seriously soliciting feedback while
explaining the biases I have coming in.

~~~
mst
Then my suggestion to experiment with all three stands.

Things you might want to look at for Perl - Moose/Moo for OO,
Mojolicious/Dancer/Catalyst for web frameworks, DBIx::Class/Rose::DB::Object
for ORMs, App::cpanminus/App::perlbrew/local::lib for managing installations
of Perl and modules, and <http://metacpan.org/> for looking up libraries for
everything else.

Also, the free book "Modern Perl" to get a feel for the language in 2013 as
opposed to the hundreds of horribly outdated .com-bubble era tutorials you'll
find on google.

You'd be best with somebody else's advice for python or ruby, most likely, so
I shan't opine there.

------
hypnotist
while we are on topic of Perl...

Can anyone recommend good modern Perl book ?

I found really huge amount of Perl code in our Linux servers :)

~~~
adrianhoward
See <https://news.ycombinator.com/item?id=5507537> ;)

~~~
hypnotist
Thanks a lot! Apparently Modern Perl book is available as a free download :)

