Perl vs Python: Why the debate is meaningless

Competition is a common thing is hackerdom, and arguments over which one of two (or more things) is the better are common and keep coming and going (but never really go away). Some of the most common ones are: Java vs C#, Emacs vs Vi (and it’s clones), Linux vs BSD, Closed Source vs Open Source and everyone’s favorite: Microsoft vs everyone else. And the internet is littered with evidence of these great wars (which none too rarely take on epic proportions) and some digging will throw up evidence on forums, website, bulletin boards, Usenet archives and of course, blogs. Today I’m taking a look at one of these wars that I’ve had personal experience with: Python vs Perl.

The last few years of my life have been filled with an as yet unfulfilled to learn some real programming (see last post). A few months ago I sat down to really learn Python, because I had a read a lot online about how it is a great beginner’s language (though I’m not really a complete newbie at this point). Anyway, I’ve been at it for a while and I’m liking how things are going.

But before I had started Python, I had a brief brush with Perl a year ago. At first glance it seemed something I had dreamed of. After struggling through memory management in C++ and Java and sitting through long compile times (which are really irritating if you’re a new programmer making lots of mistakes), Perl’s write and run was a dream and built in memory management made me a lot happier. But it didn’t take too long for me to get dissatisfied. Reading other people’s code was never very easy and variables behaving differently in different contexts was not something that I liked. I left Perl in just over a month.

Looking for an alternative I quickly found out about the Python vs Perl debate and was especially inspired by Eric Raymond’s Linux Journal article. I started Python and quickly fell in love with it. It had all the things I liked in Perl, but none of the eccentricities that I had wanted to leave behind. For a long term I didn’t give Perl another thought. But being the avid netizen, open source fan and linux lover, I kept reading about Perl here and there. So, last December, I decided to look into Perl again.

What I found out since then is that the Perl vs Python debate is rather like apples vs oranges. One of the biggest complaints about Perl is that it is untidy. Perl’s philosophy of “There’s More Than One Way To Do It” means that there are numerous ways to twist your code syntax around and it can be made absolutely unreadable. And it’s not just the syntax. Perl’s later features, especially object-orientation, have a distinctly kludge-like feel about them, as if they were simply slapped on later rather than integrated. Python, on the other is much cleaner and better designed. But there’s a twist to this tale. It’s this: Perl and are Python are very different languages.

Firstly Perl was not meant to be a general purpose language. It was meant to be a sort of shell-script on steroids. It’s a glue language, aptly called a Swiss Army Chainsaw. If you have a myriad of different programs and data sources and all you need to do is bind them with the electronic equivalent of duct tape, use Perl. Keeping Perl to it’s original uses makes most of the problems disappear. You don’t come into contact the kludginess of more advanced features because you will rarely (if ever) use them and readability isn’t so big a problem, because your programs will not genrally be more than a hundred or two lines.

Python on the other hand, is a more general purpose language. Features like object orientation are better implemented because you’re expected to use them all the time. And there is a definite emphasis on writing clean code because your programs will be big with complex tasks, not just delegating to other programs.

So the final word is this: choose your tools carefully. If you need something that will update a web page with a list of recently played songs, use Perl. A good example of how to use Perl effectively would be Xterminus’ changes page, which uses a Perl script to gather data from his account and his wiki software and create a pure HTML page. If you want to write anything with more than a few layers of abstraction and of more than medium complexity, grab Python. If you have any experience with these two, let me know.

Tomorrow’s debate: Emacs vs Vi

Update: I had said above that I found memory management in Java and C++ tedious, I admit that was something of a typo. I hadn’t meant to say just C++. Thanks to Digg and Reddit users for pointing this out.

44 thoughts on “Perl vs Python: Why the debate is meaningless

  1. You seem to suggest that different tasks conveniently/necessarily require different languages, but sticking to one language (a single syntax) often brings more power to the programmer. This also facilitates resue.

  2. There are established best practices that make Perl code very readable and easy to maintain.

    What’s up with those no-brackets-indentation-only approach huh? Doesn’t that make your head spin? 😛

    I’m not saying that Perl is the best and that all other languages are useless. I believe every language has it’s strengths and weaknesses. But most of the time Perl’s strengths are greatly underestimated and it’s weaknesses overstated.

  3. I’ve write code in C, Java, Perl and Python. In all of them, if you want your code to be readable, you have to indent (except for python, you’re not required to). So the brackets are useless, since every language encourages the indentation. If you want to bracket python, simple do it with the help of the comment symbol #. Easy.

    while(True): #{
    doSomething #;

  4. To the Perl aff(licted|ianados):

    You are defending a scripting language with *pointers*.

    If I want to use pointers I will use C, thanks very much.

  5. I don’t know Python but I can comment on Perl. I have written many elegant scripts for complex problems and I still love it. I often come across comments about how a programmer went back to his program six months later and had difficulty understanding it. For my part, I haven’t had this problem primarily because I use consistently a single syntax. If perl provides more than one way to do things, I choose and use only one. Secondly, I do agree that objects in perl are clunky and make for difficult writing/reading. I have never used them. This makes it difficult for me to write perl scripts for large projects. Perhaps this is where Python succeeds.

  6. Perl vs Phyton
    Since my new job required Perl i also plumbed into this we discussion. I wondered should that job be done with Perl..
    I agree one might be able to read his own code back.
    But have you ever tried to repair or code from other people or add some extra functionality. I gues that’s a perl nightmare.

    Dont get me wrong i’ve used many languages from a beginning to novice degree and some expert, to give you an idea: Basic, Qbasic, Phython, Pascal (several versions), C++,C# plain C VB6 Kixstart VBscript and some others.

    My first impression of Perl, it’s like Kixstart and verry old Basic (without MS in front). Kixx a cutom shell language, and basic well it can deal with vars but in a bit $poor way.
    Looking at phyton i see a some good editors and a much more clean language.
    Notice that a final compiler doesnt compile spaces (..duh).
    Spaces are for readability.

    Other people will be able to read someone else his phyton, and understand it i’m sure. I dont believe this for perl to be treu.

    That doesnt make Perl a hardcore type cool language, it’s making it an old language. Computer Languages evolve
    In the end it doesnt make a big difference how you get things done, if you only wanted to get them done, but there is more..
    You see I’ve also did assembler once. And could get things done with it but does that code fast / or is it easy to repair to maintain ?
    Nope.. old languages are just not cool. You can stay with it but the next generation people will slam you.
    Old languages can be full of tricks (like kixx and perl) but are poor in meaning of the word “language”

    Sadly i was also just looking into en again (new version), if you would compare those languages to perl of phyton then you see a huge difference in well first syntax but next support click a unknown verb and get forward to MSDN online help with samples and comments that must be magic to perl/phyton people.

    Serious programmers no they should once in a while look around to other languages.. that might be something for perl-scripters to get started to think about a language.

    I wish there was a
    you see even MS was abele to make Basic o-o

  7. I was forced to learn Python in order to write scripts within Blender (Open Source 3D Modeler).

    White Hat:
    1. dir( object )
    This is nice as it shows functions and constants.

    Black Hat:
    1. Indention to denote code blocks. (!caca?)

    PERL was more of an experiment instead of necessity. Much of what I know about regular expressions probably came from reading about PERL. I never even wrote much code in PERL. You see CPAN (Repository for modules) alone makes up for all the drawbacks I can’t think of at the moment.

    White Hat:
    FreeBSD use to extensively use PERL for installation routines (4.7., I keep a copy of it in my music case although I don’t know why as I feel its a good luck charm of sorts). Then I read in 5.0 they started removing it in favor of shell script (BAsh). Why?

    Black Hat:
    I’m drawing a blank here.

    With freedom there are costs, you are alowed to do as you please. Place variables as you must and toss code a-muck.

    You can dislipline yourself to write great code in any language. VB-Script I write has the apperance of a stardard practices C application.

    I think it’s a waste of time to sit and debate over which language is suited for which project. Pick one and master it.

    So you can’t read PERL? Break the modules into several files. It’s more about information management than artisan ablility. Divide and Conquor.

  8. I disagree with mastering one language. Often there will be trade-offs in a program that match very nicely with a particular program.

    For example, you could code everything in C++\C\assembler, but that only makes sense when you really need speed or memory compactness. After all, I find it difficult to write basic file processing applications in C in under 10 minutes.

    Perl examples use a lot of default variables and various ways to approach problems, but this is really a nightmare when you have to maintain someone else’s code. Especially if you don’t know Perl. I think its hard to understand (without a background in Perl)

    while() {

    immediately. Not to mention shifting arguments to functions and the various ways to call one

    The equivalient in python:

    s = raw_input(”)
    s = s.strip()
    print s

    Even if you don’t know Python, you can understand it if you know Java\C++\C# etc.
    Indenting helps code readibility, sure some formating utilities don’t work nicely without braces, but its also a must for writing maintainable code for someone else.

  9. I’m a perl guy not a py programmer so I won’t detract from python [except for the braces, Guido should at least let the language compile with them].

    Note: Perl is like English it’s a reflective language. So I can make nouns into adjectives and use the power of reflection. For example … ‘The book on my living room table’ vs [Spanish] ‘The book on the table of my living room’.

    And this makes sense … because Larry Wall was a linguist; and was very influenced by the fact that reflective languages can say more with less because much is implied based on usage. These languages can also say the same thing many different ways. [Perl makes me pull my hair out. | Perl makes me pull out my hair.] And being that we have chromosomes that wire us for human language … these difficulties are soon mastered by even children. But … but we don’t have the same affinity for programming languages (well most of us) so yes Perl can be a struggle in the beginning. But once you achieve a strong familiarity and stop trying to turn Perl into C or Python and allow Perl just to be Perl you really really start to enjoy it for those reasons you didn’t like it before.

    The biggest failure of Perl has been its users enjoying the higher end values of the language and failing to publish and document simple examples to help non-monks get there. You shouldn’t have to be a monk to seek wisdom at the monastic gates.

    Example … Perl classes. Obtuse and hard to understand you say? It doesn’t have to be … I think that most programmers will understand and be able to write their own after just looking at this simple example. Keep in mind, we just use ‘package’ instead or class. Bless tells the interpreter your intentions and is explicitly used because you can bless all kinds of things … including a class (package).

    my $calc = new Calc; # or Calc->new;
    print $calc->Add(1);
    print $calc->Add(9);
    print $calc->Pie(67);

    package Calc;
    sub new
    my $class = shift; # inherits from package name, 'Calc'
    my $self =
    _undue => undef,
    _currentVal => 0,
    _pie => 3.14
    bless $self, $class; # now we have a class named 'Calc'
    return $self;

    sub Add
    my ($self, $val) = @_;

    $self->{_undue} = $self->{_currentVal}; # save off the last value

    $self->{_currentVal} = $self->{_currentVal} + $val; # add the scalars
    return $self->{_currentVal}; # return the new value

    sub Pie
    my ($self, $val) = @_;

    $self->{_undue} = $self->{_currentVal}; # save off the last value

    $self->{_currentVal} = $self->{_pie} * $val; # add the scalars
    return $self->{_currentVal}; # return the new value

  10. I disagree with the notion, put forth by the original author, that you should use Perl instead of Python for small glue scripts. I know and work with both languages and write glue code on a regular basis, and can’t really say that either is better. But, I can say that Python definitely holds its own, and for truly one-off jobs (like data (wr|m)angling) the interactive Python prompt is quite handy (actually I hope something similar finds its way into Perl6, should there ever be a Perl6).

    1. If you want an interactive shell in perl, the easiest way is to fire up the perl debugger in command mode.
      just run perl -de 1
      Be careful declaring lexical my vars this way. Scope becomes a single line.


  11. Hi Basu,

    you are highly prejudiced about perl. I programmed in perl then moved to python and Ruby…finally I am back to perl.
    The reason is that perl has many advantages than python or ruby.

    Python and ruby are slow. U need to know C to make python run faster using pypy, inline etc.

    Mod-perl is the superior to mod-python and WSGI-python; you can rip apart pache with mod-perl

    I don’t need to learn C (or) any other language again when using perl.

    Ruby looks like 3rd class crap to me with different kind of blocks.

    Actually python and ruby languages suck the hardness of perl and present the syntax in a nice way but see that’s the reason why they suck most.

    Try creating webapps with spaces using python and u suck desparately. Almost all programs in python are slow. “youtube” sucks most. NASA uses python to make their calculations wrong. Google uses python-ORM to improperly index databases so that we don’t get proper results for what we search.

    Python creators are sloths. They cnanot walk. They use wheel chair to go to toilet. Python was never useful in production environment as it sucks ass due to slow run time. Screw psycho, pypy and inline.

    If u don’t want to have mid life crisis use perl. There are no python jobs anywhere. Many reasons are:
    1) slow run time
    2) Refactoring sucks ass and double ass

    Use perl for anything. Python and ruby libraries have just 1/5 of perl libraries for doing any task.

    Web 2.0 is not so gr8 other than for buzzwords. AJAX is also not useful if u have large data.

    I can challenge any programmer of python or ruby for writing faster programs than perl.

    Readibility will be there more in perl if u use properly the language.

    perl can do anything and everything. It is universal panacea. U will know that when u try solving many problems that require help. Perl is big daddy to care for people like u when u lift hands in desperation after trying other languages. Don’t listen to 3rd class people about hteir sick opinions on perl6. Similar things were told about perl5 and see till now perl5 rules in speed and libraries.

    If u have nay doubt in achieving any task ask me or perl monks. almost all ur problems may have been already done.

    Catalyst web framework and Rose ORM are ultimate. Try them if u really need to make web 2.0 like apps.

    Think with calm mind and u know the truth.


  12. Just to add more—

    Python OOPS is shit to the power of 5000. Ruby and Java are atleast ok in that. Perl has an intelligent OOPs that u will appreciate once u code in that. It was designed to be more programmer friendly. Read Damian Conway book on OOP perl and u will open ur eyes to the truth.

    May god punish all those other language creators and programmers and burn them for the hatred and rumours they are spreading on perl.

    I am the first perl programmer to react so violently as I am fed up with 3rd and 4rth class bast*rds.


  13. Perl is not a scripting language, strictly speaking, and neither is Python. Perl is an extaction and reporting language, and in that field it is pretty unbeatable. An general application language it is not, nor was ever intended to be.

    Perl is the sysadmins friend, because systems administrators do a lot of, well, extraction and reporting. Want to make sense of several million lines of awkwardly formatted log files ? Perl is your friend.

    My main beef with Python is that it looks like Visual Basic circa 1995.

  14. One thing about perl that i have found that
    I haven’t been able to do in any other language
    is print a number to the 5 millionth place
    like this

    require “”;
    print fdiv(1,23**.2345, 5000000);

    if you can do that in any other language
    let me know… what language it is!

    “one thing is for sure is that I don’t think
    you could do that in less code.”

    I would love to be able to do that in C++ or C
    even using more code, PLEASE let me know
    if you figure out the code for that

    and ASM would be even better!

    1. Hi Mark

      You can do this in Java using BigDecimal for immutable, arbitrary-precision signed decimal numbers, whilst C# has a “decimal” 128-bit data type.

      These types/classes are useful for financial calculations where small fractions are important to the resultant sum. Other application domains such as graphics and many scientific areas sometimes don’t need such precision, but do require speed for numerically intensive calculations (Fast Fourier Transforms for example).

      A classic speed / precision trade-off.

      Example code follows:


      BigDecimal payment = new BigDecimal(“1115.373322233445”);


      decimal payment = 1115.373322233445

      C# “decimal” uses 128bits and is syntactically quite clean, however Java’s BigDecimal is of arbitrary precision.

      Hope this helps.


  15. Firstly, we should understand that Perl and Python (or any other language for that matter) are different. If they were exactly the same, why have seperate languages i.e. Perl or Python in the first place? Their difference is what makes one more powerful in a particular situation.

    Now what that “situation” is depends on the programmer. For some, this is easy in Python, for others that very thing is even easier in Perl. The best thing to do is NOT CARE what others think, and find out the facts for yourself.

    If you’re a real programmer, you’d have no problems learning the basics of a new language in an evening. The best thing to do is, pick up a Python book and a Perl book, sincerely learn them both. Don’t “compare” them line to line, for they’re different (as I said before).

    Exploit their strengths. People for ages have been saying “C/C++” can become unreadable, and one can’t read his own sourcecode that he might have written months ago. But that doesn’t stop critical applications from being written in those languages. Don’t let other’s thoughts and conveniences influence your own logical judgment.

  16. Hi baboo again!

    Serious stuff
    1) Just use perl man. New OOPS module came up called MOOSE. So u don’t
    need to use any other programming languages.
    2) Also, catalyst rocks and there are a lot of success stories around
    perl and catalyst.
    3) Particularly python’s GIL flop story and ruby flop story with
    parallel processing made people look back to perl for help. (Of-
    course scala is also used by some). I always told about perl as big
    daddy, check earlier post/s and it is proved beyond doubt.

    Funny stuff
    1) God will burn u if u use any other programming language other than
    perl. 🙂
    2) U shud not do friendship with people using programming languages
    other than perl. 🙂


  17. I have led a commercial Perl project with >5 programmers and +100k lines of code. The perlish “There’s more than one way to do it” can hurt you severely when there are too many “individual” developers that can’t agree on common idioms and code style. This is easier said than done, as there are way too many things in Perl that can be done differently and that have to be agreed on and reviewed and enforced constantly (e.g. parameter passing via shift or list matching; MooseX, “manual” OOP or using Moose or Mouse or Class::InsideOut; documentation/POD style; packaging; use of test suites; even things like call your instance “self” or “this”).

    Moreover, Perl5 OOP without Moose is not worth the trouble. There is simply too much boiler-plate code in every class, you need too much discipline do stay consistent throughout the whole project. Moose, however, does not only alleviate the “OOP burden” in Perl but has so many cool features missing from languages like Python that it may well be a reason to use Perl by itself.

    If there is one thing that I have learnt in my Perl projects then it is that it is not easy to find “appropriate” Perl developers. “Appropriate developer” does not mean “good programmer” as there are many people out there who are able to take Perl to its maximum. My major complaint is that these people are the ones who are responsible for all the “bad press” out there. The inability to find people to write and maintain your software over the complete lifecycle is *the* major risk using Perl.

    Good software should not depend on its programming language, in particular it should not depend on language features that most people don’t understand. If you get to a point where your Perl code becomes indistinguishable from, say Python code or Java code, *and* you are taking advantage of the cool things about Perl like mod_perl, Moose or the huge amount of packages in CPAN then Perl definitely might be the right choice.

  18. I can see that when somebody tries to promote one programming language over another, they obviously do not know the language they (use|don’t use) as well as they should.

    I am an avid Python user, but I highly respect Perl magicians. To this day, I am still trying to better learn Perl and can not use it as well as I can Python. I do appreciate how Perl is a better language choice in some cases than Python.

    Just because you can not understand somebody else’s Perl script, it doesn’t mean the language is bad – it’s because you don’t know Perl well enough to interpret their code.

  19. Here are the languages I have used:
    Assembler (several architectures both MIPS and RISC)
    Basic (DOS and Visual)

    My impression coming onto a project using over 23K lines of Perl and years of different developers:
    I will grow old and die trying to understand that code!
    There is consistency in style mostly on this project and that is a blessing. However, understanding the nuances of all the sorting, pattern matching, etc is serious brain damage. It is working code and I touch it as little as possible.

    My impression of python:
    Easy to understand and use. Once I got my head around that this is not C++ it was easier to break the rules and do it the Python way. For new projects I will pursue Python or PHP (webbased).

    Neither of these were my first language. My learning went like this: Pascal, Assembler, C++, C, Basic, a bunch of other crap, Python, Perl, more crap. My preference is to use Python for projects as I can lay out the code quickly. The next I grab is C++. For web however, I grab PHP and try to stay away from Perl except for existing code.

    However, one thing impressed me about Perl. When I needed to use Perl with a PHP session I was able to find working Perl code that bridged that gap. This allowed all authentication to be through a CMS system based upon PHP, but allowed me to maintain the high quality working Perl code to continue on as though nothing had changed. That is a testament to Perl programmers.

    Right now I am working on a project where I need to receive an event from an internet client, queue the event, process the request on a server different from the web based server, send a resulting file to a third party website, send a message back to the client at a later time (latent notification) about where the information was posted. The initiating event will be done in PHP, the storage will be in MySQL, the second server will poll the database of the first using possibly a combination of PHP and Python or just Python. The second server will launch an application using Wine to produce the file and post this file.

    Python was my choice because it is so versatile and I don’t need to spend a lot of time getting versed in it. Even though I has used Python before learning Perl I had forgotten most things about Python. It took only a couple of hours to get back up and productive. I only have so much time on this Earth to do things. If I am going to do something I am going to use the tool with the most bang for the buck for the application at hand. A language may have superior processing of whatever data structures, but what use is it if the brain damage required to understand those features takes up more time than to create the solution in a different language in the first place? Yeah, that was a run-on sentence. : )

    So, yes, the debate is meaningless. Different tools, different strengths, and vastly different user bases. I would not for a second think that a computer genius using his tool of choice could not crush a novice with a sexy new computer language any day. I am not that genius and Perl and me don’t get along.

  20. I am a System Admin with over 6 years of experience working with big companies.
    And I have yet to see 1 (really, even 1), Server which has python installed on it. These are hardened servers, so they only installs minimal things that are needed.

    Perl is ubiquitous. Its on every Unix/Linux Server. A server might not have xterm or top or wget, but it has perl.

    That oughtta tell you something!

  21. I agree with this article 100%. It’s like a carpenter asking “what tool is better, a saw or a hammer?”. I’m shocked to see the many responses from people promoting their language as being somehow better. There is a difference between what is more practical for a given task and what is more enjoyable. Most people’s arguments essentially boil down to an argument about why one language or the other is more enjoyable.

  22. I’ve been scripting with perl for a while and have recently started looking into python. But something is hanging me up with python’s re module and since regex accounts for most of what I need this is sorta a show stopper for me. Maybe someone can clarify for me (trust me, I’ve searched the web high and low to no avail).

    How do you write a regex in python that includes variables?

    That is, in perl (condensed to as simple an example as possible, e.g. $vlan will be dynamically changing based on an input data set, and we’re plowing through many lines, not just one, etc):

    $vlan = 100;
    $line = “100 I want to capture THIS thing only if line starts with vlan”;
    if($line =~ /^$vlan.*?(THIS) thing only if line starts with vlan/) {
    print “$1\n”;

    In python the closest I’ve gotten since I can’t figure out how to use a variable in a regex is:

    import re
    vlan = 100
    line = “100 I want to capture THIS thing only if line starts with vlan”
    m =‘^(\d+).*?(THIS) thing only if line starts with vlan’,line)
    if(int( == vlan):

    Actually, perl would be even less messy using $_:

    $vlan = 100;
    foreach (@lines) {
    if(/^$vlan.*?(THIS) thing only if line starts with vlan/) {
    print “$1\n”;

    Anyway, I’m not trying to put python down. I really really like it so far. But I’ve lived with perl’s regex for so long that I’d miss not being able to alter a regex dynamically. Maybe there’s a python module I’m not aware of that extends re?


      1. Looks like it does 🙂 Anyway below are the two examples, with proper indents…

        $vlan = 100;
        $line = "100 I want to capture THIS thing only if line starts with vlan";
        if($line =~ /^$vlan.*?(THIS) thing only if line starts with vlan/) {
            print "$1\n";
        import re
        vlan = 100
        line = "100 I want to capture THIS thing only if line starts with vlan"
        m ='^(\d+).*?(THIS) thing only if line starts with vlan',line)
        if(int( == vlan):
  23. In response to qo ^^

    Python is strongly typed, so make sure it knows that vlan is a string. Also, the regex is itself a string. Just concatenate vlan into your regex when you pass it.

    import re
    vlan = “100”
    line = “100 find if starts with vlan”
    m = re.findall(“^” + vlan + “.*”, line)

  24. Hey, thanks much jameslaymusic! Your tip regarding contatenation within the re was exactly what I needed.

    import re
    vlan = 100
    line = "100 I want to capture THIS thing only if line starts with vlan"
    m ='^' + str(vlan) + '.*?(THIS) thing only if line starts with vlan',line)
  25. I agree completely with the author. Language hipsterism always makes me want to roll my eyes. The discussion always seems to start with a broad assertion that one language is “better”, with an implied “in all contexts”.

  26. First of all Perl should never be compared with Python, but rather Perl can be compared with C/C++ because Perl running approximately 10x faster than Python. Python could be compared with Ruby, PHP and other slow running programming languages.

  27. This author hit the nail on the head. Perl is a better shell-scripting language and Python is apparently better for large, non-shell-scripting programs. But most shell-scripting is partitioned into shorter, top-to-bottom executing programs anyway. Perl has many practical capabilities built into the language that any shell-scripting language benefits from: string variable interpolation, easily capturing STDOUT from an operating system call, “here documents”, etc. Python suffers in comparison. In fact, Python has less string variable interpolation capability than any “scripting” language, including even 50-year-old IBM JCL. The lack of these simple practical things that has limited my use of Python. But I will accept the opinion of others that Python is better for large non-shell-scripting programs. By the way — disliking Perl because of the ‘$’ is petty, especially since the ‘$’, ‘%’, ‘@’ at the beginning of a symbol makes identifying and using it’s three basic types very easy.

  28. So Do you mean python is better in terms of high complexity and perl is the best if going for few layers of abstraction where complexity is less? Anyways I prefer python as per the complexity wise and my experience with python and perl. Thanks for the great article explaining in detail.

  29. Perl is better for scripting a procedure. It was originally developed for that and has many simple, practical features for that built into the language that Python does not have. The object oriented features of Python are not as valuable for scripting a procedure and can make the procedure obscure if OOD is overused.

    1. A lot of my use of Perl is to automate a sequential procedure that I could do as an operator. They are a top-to-bottom sequence of “call an application => capture text results from STDOUT => extract information from the results => decide what to do next => call the next application”. Usually there are reports generated at certain steps and usually several of the applications called are other Perl scripts that already automated parts of the task. Perl is very good for this type of programming.

  30. The best reason to use multiple languages is if you have to maintain code done in those languages. One thing I hate is when someone advises a total re-write just because he doesn’t like the language it is in. They want to spend several months rewriting and debugging just because they don’t like required indenting (Python) or ‘$’ in front of variables (Perl). They are just opinionated fools.

  31. Whilst I have no issue with where you say Perl came from, I do take issue that it is not a general purpose programming language. This is just not so. It can be put to many different and varied uses. One can efficiently fiddle around with low level binary data right through to implementing full blown desktop GUIs (I have done both).

    The native OO system in Perl is not a kludge but logically extends its procedural mechanisms to achieve this. Yes it isn’t as nice as in Python (after all that is Python’s bread and butter) but that doesn’t mean Perl’s way of doing it is bad. Infact Perl’s OO system and lanuage mean that OO works a lot better in Perl in certain important respects. In Perl you have reliable destructors so that one can implement cool tricks using RAII paradigms. You wouldn’t have a hope of doing this in Jython and the non-standard scoping rules in Python and Jython blow stuff like scope based locking out of the water. Yes you can use a with clause but that is a kludge to get around the lack of normal scoping and reliable destructors. In Perl and C++ one can simply enforce correct usage of scope based objects without recourse to additional clauses in the language.

    As is usually the case with such postings, you also have not spent that much time with Perl. Sigil usage and context of how a variable is used is actually straightforward and logical. It may be different from what you have seen before but all languages have their quirks. For instance could you tell me the precise difference between the Python sigils _ and __? Don’t worry I know:-). It takes time to learn a language properly.

    Anyway all the best and hopefully you’ll have an opportunity to really get to know Perl properly in some project or other.

  32. I too find the Perl criticisms empty. While admittedly I am not a Py programmer, I have written much with Perl in the last 10 years. I currently have written and manage large GUI and non-GUI programs totaling upward of 50,000 lines of code. Some of it quite complex, all of it using OO techniques. When I started with Perl, I was amazed what I could do with it. The only limitations that I find with Perl are performance related. No (real) multi-threading, limited heap memory, etc… This is not to say that Perl is a slug, but just not as fast as native compiled C.

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