Perl or Python?

After discovering Arduino it looks like I have to learn at least one new programming language. And I'm not talking about the language used to program the Arduino, which is (based on) C/C++. What I need to learn is to connect the Arduino to a PC, via the USB cable, and from there to The Internet. The point is that I already have a Linux server running and I don't need (or want) to connect the Arduino via Ethernet or WiFi. Also using the server I already have I don't need an external power supply for the connected Arduino.

I have found three choices to read/write from/to the Arduino. PHP, Perl or Python. In my opinion PHP is not really suitable to be used as an interface trough the serial port. PHP was not designed to "loop" or read the serial port, even if the serial library looks OK. I have discarded PHP for this purpose as of now.

Many years ago I used Perl to manipulate some huge text files containing email addresses. I could go for Perl with a serial library and I could go for Python, also with a serial library. I have not yet decided. I'm lucky enough to have a free subscription on Lynda.com at work and I have had a look at some Python courses there. I did also take a refresh course on Perl.

Python

It's said that Python code is highly readable and easy to learn, but I guess that's for newbies? Having programmed in PHP for many years I hardly think that Python code is readable... It's object oriented, which is a good thing. It's also free and open source. The last one is, to me, important. On the other hand it forces programmers to follow certain conventions. And the fact that if you indent the code wrong, you'll break it...

Perl

Perl is a bit like PHP and other similar languages, in the sense that you'll use braces in functions and loop. To me that makes sense and it makes it easy to read. And intendation is not an issue, like in Python. Perl is also object oriented, Procedural and Functional, even if the object oriented part is not so well implemented. Another downside of Perl is the handling of arguments.

Pitfalls?

To keep this to a minimum I will select one over the other, but which one should I go for? What can I expect from choosing one over the other? Will I end up in a ditch down the line from choosing one over the other? In your opinion, what's the ups and downs when choosing one over the other?

I appreciate any and all help on the matter. Smile

Tags: