Perl or Python?

Marc Lanctot lanctot-yfeSBMgouQgsA/PxXw9srA at public.gmane.org
Wed Jul 1 20:57:53 UTC 2009


On Wed, 1 Jul 2009 12:41:12 -0700 (PDT)
Rajinder Yadav <devguy-DaQTI0RpDDMAvxtiuMwx3w at public.gmane.org> 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?
> 
> comments, feedback welcome.
> 

I've coded in both, but have much more experience with Perl. 

It's basically a "use the right tool for the right job" argument.

"Powerful yet simple scripts" is too vague. What is powerful? What is
simple? Does simple mean least number of lines? Then perl is probably
your beast. If it means programs that are easy to read and follow? Then
it's python. If by powerful you mean has a large standard library,
implements OO "properly", I'd recommend python. If by powerful you mean
can handle regular expressions in string matching implicitly, then use
perl. 

Perl was made for parsing documents. Think of it as a step up from
bash scripting. With CPAN, you can find Perl modules that do pretty
much anything. It is extremely flexible, but it's not uncommon to find
Perl scripts that look like a dump from /dev/urandom.

Python is still a high-level scripting language, but higher than Perl
is. Python is more like Java, really. It is a full-fledged language in
the sense that it comes with a standard library, enforces stronger
syntax requirements, etc. etc. 

Marc

-- 
If you want to travel around the world and be invited to speak at a lot
of different places, just write a Unix operating system.
  -- Linus Torvalds
--
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