Python or Perl?

Posted by

I recently started working my way through Nathan Yau’s book Visualise This.

In it, he introduces readers to Python. I dutifully downloaded Python and started playing about. I don’t know much code (I’ve mucked about a little in VBA and R), but I found Python easy to pick up. This is probably partly due to Yau’s good introduction, and partly about the ease of learning Python.

As time is short, I don’t fancy learning lots of languages (this is a key reason I chose to learn R; it’s free and kept well up to date, so I am pretty sure I won’t have to learn another stats package); given this, it wasn’t long before I started to worry that maybe I could better invest my time in learning Perl.

I’ve spent a few hours looking into the Python v Perl question and I am now satisfied that Python is the correct choice for me (I also discovered that this is a hotly debated question). I found the following article helpful; I also enjoyed this presentation by Bruce Eckel; Bruce’s slides can be found here.

So, I’m learning Python. I chose to go with 2.7.2 (rather than 3.2.1), as there are more canned packages that work with it just now.

Installing Python was easy, however to run code from the command line I had to edit my system’s path variable. I have Windows 7, so to do this on my machine I had to open the desk-top in explorer; I right-clicked “my computer” and selected “Properties”; selected “advanced system settings”; selected “Advanced”; selected “Environment Variables”; in the “System variables” box I selected “Path”; next I hit “Edit”. Almost there…

I installed Python to C:\Python27\, so in the “Variable value” box I added “;C:\Python27” to the end of the path string. Now when I type “python” at the command line, I call python; better still, commands such as

python py\code\

execute my python code (in this case, the command executed, which is stored at C:\py\code\, with python)

Additionaly, I downloaded PSpad to use as my text editor for hacking Python code. I found PSpad so easy that I’ve now used it a bit for R as well (I typically use R-studio and tinn-r).

As for Yau’s book, I’m half way done, and I rate it 7/10 thus far. I’ll write a review when I am done.


  1. Amusing, you found an article from 2000 helpful in deciding between Python 1.6 and Perl 5.6? And I especially love the out-of-context quote from Larry Wall in that presentation. Perhaps you shouldn’t ask Python fans to help you choose between Perl and Python, unless you had already decided. Which seems like the case, seeing as you were already familiar with it.

    1. The issues don’t seem to have changed since these things were written, and i think the essay in particular tells the story well. From reading the web, the argument always seems to be have been between those that prefer Python’s logical flow, to those that prefer the flexibility of Perl.

      For what it’s worth, i have Perl 5.14 on my PC, and i got it prior to the flowing-data book / Python – the original reason was because some canned R package needed it to fetch data. I tooled about with it, but found it somewhat frustrating. Once i started with Python, it reminded me that i had planned to learn Perl. hence my inquiry on the subject.

      please – persuade me. feel free to post links or comments on this topic. i’m only marginally invested, and would prefer to be re-directed now if i am indeed on the wrong course.

    1. Thanks, book-marked!

      It is a bit of a shrink wrap problem, don’t you think? You can really only say which is best if you learn both, but that is costly. I went for python as folks said it was easy. Even the Perl folks say python is easy – they pan it for powerlessness and rigidity.

      I need grunt less than i need ease.

      Sent from my iPad

  2. I use Perl or PHP for web development (small projects), C/C++ for anything else! cheers

    1. By the way, Perl, PHP, C, C++ and C#, they all belong to the C style family. So if you learn C, you will find easy to learn the other languages too. When someone asks me which computer language to start learning, I’d say C.

      1. Thanks. Here is another question – PC, mac, or Linux?

        I use a PC but it seems like much development is done is the latter two.

        Sent from my iPad

  3. All above languages are supported on all platforms so it does not really matter. C# is relatively new and it’s PC only (as far as I know). I use PCs and I login a remote server for a Linux system with the Apache web server installed on it for web development.

    What’s your goal / project ?

    Perl is pretty powerful for text parsing. PHP combines very well with HTML and has very strong database support, i.e. MySQL. PHP and Perl syntax is very similar, in fact I sometimes confuse the two.

    1. Right now I mostly want the tool for getting and managing data. Both scraping data from html/ xml, and downloading data in excel/csv/txt formats and storing/managing it. I have done excel into access with VBA, but it feels a bit limited and i couldn’t figure out how to scrape with VBA.

      I suppose later I will scale up to an SQL database, and I have read positive things about linking R and Python. Like many people, I have not made an effort to keep up with this technical stuff, but now the things I am interested in have forced me to confront my lack … I have run into the limits of what I can do with the tools I know how to use.

      Are we all hackers now? :)

      Sent from my iPad

Comments are closed.