is perl still worth learning

Someone entered “is perl still worth learning” into a search engine and found my blog.

The answer is Yes.

Python and Ruby are not inherently bad, but Perl is at least as useful and modern as them, it has – arguably – a wonderful community of programmers, it has an amazing library of reusable modules called CPAN.

My wife Hadar is starting serious work on her PhD in physics in the Technion. The guys in the lab in which she will be working wrote some calculations software in Fortran on Windows. The first thing that Hadar is doing is deciphering this Fortran code. She asked me for some help, and i couldn’t provide much, because i don’t really know Fortran. I suggested that she will advise those lab guys to consider porting their software, at least for the future, to Perl, because it is portable and because it is quite possible that it has the same capabilities for mathematical and scientific work as Fortran has. She told it to one of the researchers there and he replied that it should not be done, because “Perl is just a language for network servers.”

Saying that “Perl is just a language for network servers” is pretty much like saying that all Russian women are prostitutes. It’s a sad and silly prejudice. Here’s an article that dispels it: Ten Perl Myths.

So Hadar learned a little Perl and PDL – the Perl library for advanced mathematics. She picked up the basics very quickly. I was pleasantly surprised that she found that Perl’s main data types are scalars ($drug = 'caffeine') and arrays (@drugs = ('marijuana', 'quaalude', 'paracetamol')), because in math it works the same way (we didn’t discuss hashes yet). I was even more surprised to learn that it seemed perfectly fine to her that @drugs is an array, but to access ‘quaalude’ you need to write $drugs[2] and not @drugs[2]. We tried searching CPAN for various mathematical functions, such as eigenvalue, matrix diagonal and linear algebra, and found everything.

So she’s gonna try that.

If she can’t convince them to migrate to Perl, i’ll have to learn Fortran and try to help them migrate from a Windows version of Fortran to GNU Fortran.


4 Responses to “is perl still worth learning”

  1. 1 Shahar 2008-01-22 at 20:44

    We all should have a soft spot for PERL. Every once in a while I try writing some piece of code to enable linguistic pattern search in a text (not a verb form, a pattern-pattern). I write it, only to lose it after a while and start all over again.
    When we’ll be rich, we should write a module for these.

    I’m quite surprised that PERL has eigenvalue etc. I use(d) it quite a bit, and never suspected these existed. (I even have a book called ‘programming for linguists’ which is really, a simple introduction to perl and its string manip. options).


  2. 2 aharoni 2008-01-22 at 22:09

    Perl, or more precisely, CPAN, has everything. (Rich GUI applications are a possible exception, but who needs rich GUI applcations?)

    I would be surprised if Perl wouldn’t have those numerical things.

    One possible problem is that Perl may be slower than Fortran or C, but that is constantly getting better, too.

    And for searching for linguistic patterns – ask me the next time you need it! I have a lot of little snippets of code that search for morphemes.

  3. 3 Anonymous 2008-04-29 at 03:17

    Why not use a language that has a foreign function interface to Fortran, such as python (f2py, pyfort), or tcl (ftcl)? That way you can incrementally change the code.

    I have a soft spot for Perl as well (PDL just blows everything else out of the water). I have written Fortran extensions for this, but you have to do it custom every time and have to know how to match up Fortran and C.

  4. 4 Anonymous 2011-03-19 at 18:19

    I just wanted to say I google “is perl still worth learning” and was surpised with what you’ve wrote at the beginning :)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s



%d bloggers like this: