Dive Deep Into Python Vs Perl Debate – What Should I Learn Python or Perl?

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Gunjit Khera

Currently a Computer Science student and a geek when it comes to Operating System and its concepts. Have 1+ years of experience in Linux and currently doing a research on its internals along with developing applications for Linux on python and C.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

35 Responses

  1. Tim Van den Langenbergh says:

    The major breaking point for Python, why I can’t recommend it to anyone: UTF-8. It’s a lot to get into, but long story short: Unicode in Perl is tricky, in Python it’s fundamentally broken.

    Unless you’re only ever going to be working with people who speak ‘murrican, don’t use Python.

    Also: Perl 6 for the win.

    • Constantin Berhard says:

      Unicode in Python 2 was slightly tricky, Unicode in Python 3 is a breeze. I don’t understand why anyone would think otherwise.

  2. David says:

    This article is a pretty good summary of the differences and advantages of each. I agree with the conclusion, both have their strengths, use the right tool for the job at hand. This is true no matter which languages you are considering.

  3. John Monteiro says:

    Gunjit, you made no mention of modern OO Perl development techniques. Nobody codes what we call “classic” Perl modules anymore.

    • Gunjit Khera says:

      Yes, you mentioned it right, perl 5 introduced OO Programming.
      Thanks for updating us and sharing your knowledge with us and other readers.
      Stay Connected :-)

  4. Constantin Berhard says:

    This article leaves out very important design flaws in the Perl language, which can very easily lead to absurd security vulnerabilities, if you’re not 100% careful all the time.

    Look at this presentation:

    Furthermore listing small performance gains (which I didn’t benchmark; did you?) between two SCRIPTING languages is totally pointless. It is like comparing two dish washers regarding their ability to knit a scarf. If you need performance for something, code (at least that critical part) in a compiled language like C or Rust.

    • Gunjit Khera says:

      Yes, but certain use cases favor the use of perl and there these minor performance gains matter, like regular expressions matching. Although i agree that as a scripting language, if you need performance you have lots of other options like: C and Rust as you pointed out or some other like: Go which can enhance concurrency when we talk of programming web servers , but Perl’s major advantage is its closeness to Linux and its tools i.e. awk and sed and its one liners where it can give a better performance.

    • Joe Chakra says:

      Actually performance does matter even for scripting. Imaginew filtering a 100 MB debug log. You could use AWK or gawk, sed or grep but Perl gives a lot more flexibility. Taking 5 seconds is very different to taking ten seconds, just because the more time between request and response the more likely you are to get distracted.

  5. djf says:

    perl is absolutely the finest – most wonderful of all options – and it makes programming languages “great again”. Everybody but python programmers know that ;-)

  6. rclark says:

    I would pick Python most every time over Perl if given a choice. Why? Readability and ‘ease of use’ trumps everything else… KISS principle at work… A few more lines to do the same job is worth it if you can ‘read it’ at a glance. For what we do, Python 3 does all we need for tasks we require of it whether reporting by writing Excel spreadsheets, or CSV, or XML or…., or networking, or simpile GUI with QT4 or Tk. In fact one of the things I was tasked at my company to do is replace the Perl scripts that were written before hand with Python replacements, so that the next guy (whether a programmer like me, or an Electrical Engineer) that comes along can easily understand what is going on if changes need to be made. The little speed you might get from Perl is inconsequential for what we are doing (pick right tool for the job of course). As for ‘ regex’, Python comes with the module ‘re’ (import re) if you need that capability. I don’t feel we have lost anything by dropping Perl and gained everything by embracing Python IMHO.

    • Gunjit Khera says:

      Thanks for sharing your views, these would be very helpful for our readers also who might be confused on choosing one of the two languages.
      Also Thanks for being a follower of tecmint, Stay Connected :-)

  7. Baker says:

    Perl is almost dead in the modern sysadmin/devops arena. Ruby is the new Perl. An article on Ruby vs Python will possibly get more hits.

  8. D. B. Dweeb says:

    Your regex example is biased.

    Consider Python:
    print re.findall(‘\d+’,str)

    Versus Perl:
    print “$& \n”

    If you look at it from the perspective of the uninitiated, it’s very obvious which one is easier to understand!! “$& \n” is UGLY!

    • Gunjit Khera says:

      Although $& seems ugly but with course of time a perl programmer can get practice of such syntax, although same would be with the python one, but main thing here would be that perl is more powerful in regex as it is inspired by and also inspired to run on linux OS, which makes it have an upper hand on python for pattern matching.

      • D. B. Dweeb says:

        Yes, but I asked you to look at it from the perspective of the uninitiated. While regex is a powerful tool, there’s WAY more involved with systems engineering than mere string manipulation. There are several Python web server development tools which use high performance regex for routing as a core function. Properly written Python regex routines can perform very well. If your usage of Python regex threatens the viability of your app then I’d say you have a design issue. IMHO.

  9. D. B. Dweeb says:

    The Pythonic file handling below surpasses the Perl example, the exception text and file close is automatic. Advantage Python!

    with open(“data.csv”) as f:
    for line in f:
    print line,

    • Gunjit Khera says:

      Yes, Thanks for sharing another important point i.e. file handling , this would surely advantage our readers.
      Stay Connected :-)

      • D. B. Dweeb says:

        Well it’s not really file handling, it’s understanding and using context managers. You were presenting a conclusion based on sub-optimal Python code! I will “stay connected” if you grant my point that in this specific example of yours it’s advantage Python.

  10. Wikihat says:

    I have read this article entirely and now I could say python will be best over a Perl ,it may third party but doesn’t matter and the matter is able to support most of the technology .

    • Gunjit Khera says:

      Thanks for sharing your view about the debate. It would surely be helpful
      Thanks for being a follower of tecmint, Stay Connected :-)

    • Constantin Berhard says:

      Nothing about the re module is third party. It is part of python. You have to explicitly import it just to avoid name collisions. It allows you to have a variable name that is "re" in code which doesn’t use regular expressions at all.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.