[Tutor] Difference between Perl and Python
Steve Willoughby
steve at alchemy.com
Sun Nov 4 23:11:03 CET 2007
Varsha Purohit wrote:
> Hello everyone,
> I wanted to know what are the differences between perl and
> python, since both of them are scripting languages...
There is plenty of difference between them and between all the other
scripting languages. Look beyond the notion of "scripting" and look at
the programming language and the paradigm it supports.
Personally, I don't see Python as much of a scripting language in the
sense that Perl is, where Perl is the "king of the quick hack"...
powerful, easy to throw together a script to get a job done in a hurry.
Not so easy (but undeniably possible) to keep a disciplined, careful
approach to writing a sizable application which will be maintained over
time.
Python, on the other hand, feels more to me like a solid, disciplined
object-oriented (dare I say "real") programming language which happens
to be high-level, dynamic and compiled to bytecode at runtime (much as
Java is). It takes a little more work to make a program in Python than
Perl, but the code tends to be more solid and easier to maintain.
Those are gross generalizations, and depend on programmer skill, but the
languages approach programming from such different angles, and encourage
such different mindsets that it's worth considering as a difference.
Each language has separate strengths. Python is less ambiguous about
what expressions mean (Perl tries hard to "guess" at an appropriate way
to interpret almost anything to do *something* while Python rejects
things that are not clear and explicit as to your intent). Python is
*far* stronger at OOP support than Perl. Perl has more convenient
short-cuts for many things, but I've found the completeness of the
Python standard lib and the flexibility of the methods and functions
inside it to ultimately give me more power even if I can't do it in
three characters.
The list could go on and on, but it really comes down to what you want
to accomplish. I'd use Perl for a lot of "scripting" kinds of needs,
one-off scripts, simple data reformatting, process automation, but would
prefer Python for creating more complex applications. Likewise, TCL and
Ruby have their own particular domains they do well within.
More information about the Tutor
mailing list