Perl or Python?

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Thu Jul 2 18:25:44 UTC 2009


On Wed, Jul 01, 2009 at 12:41:12PM -0700, Rajinder Yadav wrote:
> I am considering investing some time learning a script language to automate stuff etc.
> 
> Has anyone here used both/either perl and python? I would like to get their feel on which is better for writing powerful yet simple scripts? I am a C++ developer so I don't need to learn about programming, just want to know which of the two script is really easy to pick up and has all the module support I could ever need?
> 
> I assume python was designed to be object-oriented from the start and thus would lend to clean OO coding. Can python do everything perl can in terms of text manipulation and extraction?

Well I have used both, although mostly perl.  Given a choice I would
pick python, although I tend to use perl for small simple programs to
just do some quick text manipulation.  The python code turns out much
cleaner and more maintainable though, and is much more consistent in
syntax (something perl can never be described as).

If you want to be able to call c libraries from your scripts to do some
heavy lifting, python is much better than perl.  Perl may have cpan,
but python has much more interesting libraries and is easier and more
efficient at interfacing with libraries.

As for object oriented, I haven't tried that in python.  I use it as
a mostly functional language, although occationally procedural when
passing too many arguments gets ineffcient.  Of course I am not a fan
of OO at all.

Certainly python is perfectly capable of text extraction and such.
There may be a few things perl is easier to use for, although I suspect
most people don't even use some of those perl features anyhow, because
they are weird to figure out.

Python has nice list handling, and handles multi dimentional arrays very
well, something perl has always been a nightmare for.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list