An interesting question posed to me today - and not for the first time. And not for the first time, my answer had to be "tell me more about your application, and about the people who will be writing and maintaining it".
A comparative diagram on the board provides some help - but of course what's important to one organisation isn't important to another, so conclusions will differ. What did we come up with?
Perl is the ultimate "glueware" with the ability to link to virtually anything - it's been hevily used for a long time and is designed to be able to talk to technologies old and new. Python connectivity's pretty good too but it's not got quite the same wide range as Perl.
Perl has been provides with many ways of doing the same thing. Now while that's great in theory (and it's great in an environment where there are people spending most of their time writing and maintaining Perl, and they know the subtle differenceces), it's something of a nightmare in a scenario where code has been written by someone who's perhaps on holiday or has moved on, and/or where a particular way of doing something has been chosen because it's what the particulare code happened to know. Python, on the other had, has intentionally got a very limited number of ways of doing things - "that's a good alternative" was NOT used as an excuse to add something to the language.
Perl assumes you know what you are doing. Which if you do
is fantastic - code can be written very fast indeed and got working very quickly - "far faster than in any other languagei" I could say ... but then if you're not entirely sure what you're doing Perl has some lovely traps that can extend you debugging cycle if you don't know the language very well
, to the extent that development ends up being slower than Python.
Both languages include documentation systems - there's Perl's POD and Python's docstrings - and I'm delighted that both languages have something like this available, for it's important that your programs contain the executable code and
programmer's comments and
Both languages originated in 1988. To remind you how long ago that is, it's the year of Perestroika (economic restructuring) in the USSR, and that same nation started their withdrawl from Afghanistan that year. Wimbledon won the FA Cup, and Stefan Edberg (now aged 42) and Steffi Graf (now aged 39) won the singles in the tennis at Wimbledon. It was 3 years before the announcement of Linux (25th August 1991) and 6 years before the very first website was created (7th October 1994). So both languages have a long pedigree.
For compatability reasons, programming languages cannot
change much over the years - you have to maintain the ability to run older programs - which is why so many languages have come along, become popular, and then faded away. In Perl's case, it's eclectic "many ways of doing anything" approach has lead to the addition of lots of other facilities along the way - most recently things like the say
function in Perl 5.10 and even more ways of doing the same thing - something to be sorted out by the new Perl 6 grammar which will allow Larry Wall and his team to clear out a lot of dead wood from the syntax used by new programmers, but at the same time will allow the ongoing support of the Perl 5 grammar for established code. Python grew in use much more slowly - see the graph - because it was in many ways hugely ahead of its time. I'll say why in the next paragraph. That meant that there weren't a huge number of features added 10 and more years ago which are now an embarrassment, and that's doubly true because of Python's "let's not provide too many ways" philosophy. Python IS headed for "Python 3000" but do not expect it to be the huge change that Perl 6 is - it simply doesn't need that sort of overhaul! And you'll see on my graph I have given two ways forward for Perl depending largely on how well Perl 6 does and how soon it comes along - but I've only given one way for Python and that's up.
Why, then, did Python take of slowly? In part because it's an "Object Oriented" scripting language [Today's article is not the place to sidetrack onto OO!] that burst (or perhaps just bubbled) into a world where scripting was structured coding if you were lucky. People weren't ready for it! In the case of Perl, it didn't start of as being an OO language - the OO features and capability
were added in 1992 and to some extent had to be fashioned around the language as it then existed. But having said that, the OO model is very flexible. Result of all of this? You can
write good code for medium sized to large projects in Perl, but you will
- almost automatically - be pushed towards good coding if you use Python.
What conclusions can we draw?
1. It is far easier to maintain programming standards into the future in Python than it is in Perl - Perl provides lots of ways of doing things which means that you need a very strong and technical managegial setup to provide a framework in which to work if you're doing a lot of long term coding.
2. Thoroughly experienced programmers can develop and maintain quicker in Perl than in Python but the learning curve is a much longer one, and for most people the pendulum will swing towards Python (it certainly does for the customer who gave me the inspiration to write this article today).
Here's a view of a customer of ours, a great fan of the Python language who works for a company that's a "Perl shop". See how he confirms my statements ;-)
"Secretly, I do like Perl but I 'think' in Python, and hate the non-maintainability that I see in Perl programs of just a few hundred lines of code. I think Perl users have a style for one-liners that doesn't scale to larger Perl programs. People need to write larger Perl programs with maintenance in mind." - Donald McCarthy
Oh - I will ONLY run training courses in languages that I like, and for customers who I feel that the language they're learning is an excellent solution. And we provide both Perl Courses
and Python Courses
. My recommendation today was towards Python - "even though" that will cost me £500.00 per delegate in lower fees as the Python course is shorter [not so many alternatives and complexities to learn!] - but I would rather earn less or even loose a prospective customer completely than I would lead someone up a garden path! (written 2008-07-23)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesA401 - Web Application Deployment - Structured Code and Object Orientation 
Object Oriented Programming for Structured Programmers - conversion training - (2010-12-14) 
Should I use structured or object oriented? - (2005-06-10)G908 - Well House Consultants - Language Comparisons 
Programming languages - what are the differences between them? - (2012-06-27) 
Rekeying a table - comparison in #Ruby #Perl and #Python - (2011-02-14) 
Public and private courses - subjects available for 2011 - (2010-12-29) 
What will we be teaching in six years? - (2010-10-17) 
Teaching Lua to a Perl advocate - (2010-09-06) 
Ruby - how does it compare and where is it the right language? - (2010-07-11) 
Books in the store in the USA - still a portent of the UK market to come? - (2010-05-08) 
The same very simple program in many different programming languages - (2010-03-31) 
Speaking all the languages - (2009-01-12) 
Ruby, C, Java and more - getting out of loops - (2008-03-19) 
FAQ - Perl or PHP - (2005-02-11)H101 - Introduction to PHP 
The power of scripting - (2016-01-12) 
We not only teach PHP and Python - we teach good PHP and Python Practice! - (2013-06-18) 
Learning to Program ... in PHP. Course examples. - (2010-11-01) 
PHP Course - for hobby / club / charity users. - (2009-03-22) 
PHP - Parse error: syntax error, unexpected $end ... - (2008-12-23) 
Perl v PHP, choosing the right language - (2008-08-14) 
From Web to Web 2 - (2007-05-21) 
The HTML++ Metalanguage - (2007-01-22) 
Sludge off the mountain, and Python and PHP - (2006-11-27) 
The LAMP Cookbook - Linux, Apache, MySQL, PHP / Perl - (2006-11-13) 
Syntax checking in PHP - (2006-11-07) 
Is Perl being replaced by PHP and Python? - (2006-08-27) 
Remember a site's non-technical issues too - (2006-07-07) 
Hot answers in PHP - (2006-07-02) 
Why reinvent the wheel - (2006-05-06) 
Testing you Perl / PHP / MySQL / Tcl knowledge - (2006-04-19) 
PHP - London course, Melksham Course, Evening course - (2006-03-14) 
Choosing the right language - (2006-03-01) 
It's REALLY easy to add a little PHP - (2006-02-26) 
Learning to program in Perl or PHP - (2006-01-26) 
FTP - how to make the right transfers - (2005-09-01) 
Central London Courses - Perl, PHP, Python, Tcl, MySQL - (2005-07-18) 
Bridging to the customer requirement - (2005-07-16) 
Happy Birthday, PHP - (2005-06-09) 
Programming languages - a comparison - (2005-05-20) 
Too many Perls - (2004-11-30) 
Portrait of the author - (2004-11-27) 
PHP v Java - (2004-11-20) 
Case Sensitive? - (2004-10-19) 
Evening classes to learn PHP - (2004-09-19) 
PHP - onwards and upwards - (2004-09-14)P201 - Perl - Introduction 
Are you learning Perl? Some more examples for you! - (2010-06-27) 
What is Perl? - (2010-06-15) 
Converting to Perl - the sort of programs you will write - (2009-03-08) 
Perl and Blackberries - (2008-10-23) 
How to debug a Perl program - (2006-06-04) 
Perl - multiprocess applications - (2006-02-13) 
Twice is a co-incidence and three times is a pattern - (2006-02-07) 
Release numbers - (2004-08-23)
Some other Articles
Perl 6 - When will we have a production release?Some Ruby lesser used functionsA special day - last Friday in JulyIncreasing Java Virtual Machine memory for TomcatQ - Should I use Perl or Python?Larger applications in PHPPictures from South HampshireHillier Gardens, HampshireWays to accept credit cards - or not!As different as night and tyres