Is there in truth no Perl?

While working on my Tel talk about DBIx::Class talk (more to follow on that), I met an acquaintance of mine from a deceased start-up I worked on a few years back. We chatted a bit, he said he's still writing in C/C++ (mainly GUI stuff), and when I mentioned I work with Perl nowadays, he said "Oh, I love Perl, I wish there were other languages like it". I, as usual, remarked that there are the Pythons, and even PHPs of the world, and he surprised me by saying "no, I mean really like Perl".

What he, and now I, mean, is not Perl as a "dynamic language" with some general ideas found in many other languages like Python, Ruby, JavaScript et al, but the idea of Perl as a "Post-Modern" programming language, that encompass ideas of Natural Languages. In this sense, Perl is unlike any other language I know. There have been elements that were borrowed, inherited, or lifted lock, stock and barrel from other languages (shell, awk, C, python), and there have been elements or features that have been borrowed from Perl (regexp and PCRE, to name one). I also am not referring here to CPAN, either as a Perl feature, or to ideas implemented in CPAN modules here, but to the core Perl 5 as it is implemented in the perl program.

I raised the question in (and Twitter), and found... not much. Marcus Ramberg suggested Objective-C as being "just as ugly and just as awesome as Perl". Dotan Dimet found Qore that "Looks like perl with a java accent". Others suggested, again, Python, which, in this context, could be seen as an "anti-perl", and Ruby, that I'm not very familiar with, but have the feeling borrowed features from Perl, rather than philosophy.

That made me think. Is Perl really a one-off, a, ahem, pearl of language design, formed from the beautiful mind of Larry Wall, but never before, or since, have been implemented in the design of a programming language? Or have there been other attempts in a similar vein that I have missed, what with there being 20 or 30 gazillion programming languages out there?


For "mainstream languages", your best bet would be Perl 6 and, to a lesser degree, Ruby. Also, I thought the "post-modern" tag only applies to Moose instead of the whole Perl language?

On Ruby, it actually was sort of a love letter to Perl. :)

Matsumoto said: "I wanted a scripting language that was more powerful than Perl, and more object-oriented than Python. That's why I decided to design my own language"

It does seem like, for me, Perl just came naturally more than any other language. Certainly it has its quirks and complexities, but then so do natural languages. But when I learned Perl, there were a lot more "Oh, of course that's how it works" moments than with other languages. With lower-level ones like assembly and C, which I had already used, there was a lot of time spent fiddling with bits and pointers, which is usually abstracted away in Perl. On the other hand, with what many people would consider higher-level languages like Java, there's a lot of time spent fiddling with things like classes and inheritance, even if you're just knocking out a small procedural task. And sometimes I look at newer languages (including Perl 6) and see that a huge amount of functionality is tied into a single operator or function, and think that it's too much, that I'm more comfortable being a little closer to the process than that even if it means writing more code.

Perl 5 seems to have just the right amount of abstraction for me: I can fiddle with bits or classes if I want to, but for most of my needs, the language itself gives me the right tools to do what I need to do without adding or removing layers of abstraction. I realize that's just me and my tasks, and others will prefer to operate at a different layer of abstraction; but after 15 years, I haven't found anything that suits me better.

Ruby does share more philosophy with Perl than you might think. Perl was a major influence on the syntax and semantics of the language, except for the object-oriented aspects of the language, which are core to the Ruby Way and are largely influenced by Smalltalk. It even borrowed many of Perl's special variables.

I'm frequently surprised by people who think that Perl and PHP are very similar languages. Perl's influence on PHP is obvious, but most of it is superficial syntax like C-style blocks, variable sigils, concatenation and method call operators, and string interpolation. After that, the syntax starts to diverge and the semantics are contrastingly different. But yeah, quickly glancing at a page of Perl code and a page of PHP code may look similar at first, as opposed to Ruby.

PHP can be more similar to Perl than Ruby to Perl, but in different areas. Ruby is strongly typed, for one, so you can't do 1 + "2" while this is okay in Perl and PHP.

But in general I'd say Ruby is still somewhat Perlish. I'd pick it over Python anytime (which *is* anti-Perl).

Javascript! There's (still) a lot of contempt for it, and attempts to turn it into something more like Java (Coffeescript, and Google's various projects), but I really love how regular expressions are first class objects, i.e. part of the language, instead of strings that get treated as regexes; and the way you can chain stuff, for example use the result of a function call as an array without having to store it into a variable first. (Plus, I think prototypes are a very cool way to write OO.)

And by "closer to English", I hope you don't mean something like Applescript, which I've always considered to be a disaster. Granted, the final close can look a lot like English, but there were/are many different syntaxes to choose from and only some of them actually worked as inteded. A script in Applescript invariably was a project copy/pasted together, because there's no way you can write a working script from scratch, or at least, in a reasonable time.

Javascript is a cross between Scheme and Self (thus, Lisp and Smalltalk with certain flavours) with a large helping of Perl thrown in (primarily regarding strings – consider the set of their methods, f.ex., or the presence of native syntax for regexes), all camouflaged behind C-ish syntax. The “Java” in its name is about as much as it has in common with that language. And I agree with bart that in terms of post-modernism, Javascript comes closer than any other language, though it does not take the concept to anywhere near the level of Perl.

I do think that there is probably no other comparable language. One thing you may notice is that Perl was designed by a linguist – neither a computer scientist nor a mathematician. And Larry was using computers as a means to an end when he wrote the language: they were not his primary interest. This constellation is very unusual and I think it largely explains Perl. If so, then it is very unlikely that there are many or even any other languages like it.

You might want to look for other programming languages designed by linguists then.

As computers are getting more ubiquitous, I believe they will sneak in more computer/programming material into a linguistics curriculum and then perhaps you'll see more Perl-like languages.

Leave a comment

About Erez Schatz

user-pic Because sometimes you need to bash your head against the wall until either you, or the wall, give up.