Solved

Is it true to say that Python is successor of Perl?

Posted on 2016-08-26
7
113 Views
Last Modified: 2016-09-01
I have a task to learn Perl, because most of scripts, written on my job are written on Perl.
But I found very little qualitative video courses on Perl. But I found such for Python.
This will be my first scripting language to learn.
I heard that Python is more advanced scripting language and can be named the successor to Perl. Would you recommend to learn Python instead of Perl. And later, on my work, when I will have task to modify some Perl script just search info about differences. Or I will be even able to remove old script and write new on Python.
0
Comment
Question by:Taras Shumylo
7 Comments
 
LVL 5

Assisted Solution

by:foochar
foochar earned 125 total points
ID: 41771671
There's no definitive answer to this, but my opinion is that they are two very different languages.  While there are some areas where Perl has fallen by the wayside to be replaced by Python, there are others where it has not.  Given the fact that your existing environment already uses Perl, I think you would probably be better served to learn Perl, as without that knowledge it will be challenging to understand the existing Perl scripts well enough to reimplement them in Python.  It also depends on the availability of libraries etc. that you may need access to, for example the InfoBlox DNS/DHCP platform has a Perl API that can be used to programmatically modify the system, but the libraries for accessing the API only exist as Perl libraries to the best of my knowledge...
1
 
LVL 26

Assisted Solution

by:wilcoxon
wilcoxon earned 125 total points
ID: 41772064
Python is not the successor to Perl (Perl 6 is the likely successor to Perl 5 but implementation is moving very slowly).  Python is not more advanced than Perl.  Perl is still alive and kicking (though with a reduced footprint compared to the past).

Personally, I would not recommend anyone to learn Python but I know that's just me.  Python treats whitespace as significant to the running of the code (eg a tab, 4 spaces, and 8 spaces all actually mean something different even if they look the same).  I find this to be a horrible design decision.
1
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 125 total points
ID: 41772194
I agree with wilcoxon.  I know enough of Perl and Python to know they are seriously different.  Perl has a massive library to support it.  It is unlikely that Python will duplicate that anytime soon.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 26

Assisted Solution

by:wilcoxon
wilcoxon earned 125 total points
ID: 41772284
Perl has CPAN for most of its non-core libraries.  I know Python does have something similar but it is not as large (unless there has been a massive increase in the last few years).  Both are continuing to grow.  Perl has some libraries that Python does not have an equivalent to and vice-versa.

Probably the biggest area of non-coverage I've found for Perl is big data libraries (HBase, etc).  However, it's also rare to find Python libraries for those.  Java is by far the most common library available for big data.
0
 
LVL 28

Accepted Solution

by:
pepr earned 125 total points
ID: 41773963
I agree with foochar that Perl and Python are two different languages. What is common for both is that they are powerful "scripting" languages. Both they are much more powerful than say a shell scripting language variations.

I have learned Perl in late 90's, and I liked it a lot. However, Perl uses very cryptic syntax. And it has impact on the readability of sources. I have learned basics of OOP on Perl, but God "bless" those who feel the Perl is crystal clear here.

The argument against Python about indentation by spaces is repeated since the beginning. However, it concerns only the very beginners. Python has its own warts, but Perl has more of them -- in my opinion.

The question like that is probably not targeted to experienced programmers with a formal CS education -- that is because they know the programming thing inside out to manage any programming language when they need to manage it. They know that there is not a single language that solves everything. They are capable to bend any language to achieve the goal.

For beginners, I cannot imagine to start with Perl. On the other hand. Python is perfect for beginners.

If there is the case when the user should learn a single language well and use it for everythin, then Python is much better than Perl (in my opinion).
0
 
LVL 26

Assisted Solution

by:wilcoxon
wilcoxon earned 125 total points
ID: 41773988
I have nearly the opposite view of pepr on Perl vs Python (except that they are definitely two different languages).  As with pepr, almost all of this is just my opinion.

Perl has a well-defined syntax and well-written Perl is very easy to read.  However, it is certainly possible to write very cryptic Perl code (just as with most programming languages).  Perl 5 does lack in modern object-oriented features in the core but Moose (or lighter variants) fixes those.  Perl 6 also fixes the OO issues from Perl 5.

I don't know Python nearly as well as Perl but did learn it well enough to write a few serious programs.  As such, I can't really say which has more or less serious warts.  However, I will say that Perl's warts are easy to get past (I don't even see them most of the time anymore).

I disagree that significant whitespace is only an issue for beginning Python programmers.  It is a fundamental design flaw in the language.  The "style" of the code should not ever possibly have an impact on the functioning of the code (but it does with Python).  You should never have to debug the visual representation of the code.

Both Perl and Python have plenty of tutorials out there for learning the language (and specific aspects of the language).  Which is easier for you to learn will likely depend on your background.  If you know C or C++ well, Perl will likely be easier.  Otherwise, I think it's likely to be a tossup on which is easier.

I don't think there's a single language that is best for everything.  You can certainly use Perl (or probably Python) for everything but there are definitely some things it is not as good at (for Perl, that is GUI applications and ultra-high-speed processing (no scripting language is good at that)).

If you need to do lots of text processing and/or regular expressions then you want to use Perl (there's a reason that many other languages have built-in regular expressions or addon libraries defined as PCRE (Perl-compatible regular expressions)).

I know Python also has at least one niche.  You can do some fascinating things using Stackless Python (which is likely easier to learn if you don't know any other programming language as some of the core internal handling is very different from "normal" (even "normal" Python)).  The MMO Eve Online is written entirely in Stackless Python.
0
 
LVL 25

Expert Comment

by:clockwatcher
ID: 41779929
I've been on the top 10 all-time for both perl and python here on Experts Exchange over the years and have used both extensively.  As the other experts have said, they're different.   Who knows, next year I may have a different opinion, but here are my current two cents.

I can get more done with less code in Perl.  Hands down.  Easily.   Absolutely no contest.   That's not to say that python takes a lot of code, but compared to perl it's Dickens vs. Hemingway--- one a little wordy, the other a little terse.  In a way, IMO, that slant towards terseness is also part of perl's problem.  Its too easy to get lazy with perl and not document and not test-- which leads to problems with maintainability.   It's not perl's fault.  You can definitely write well-documented and easily maintained perl code.  But I'm a human programmer with too many tasks on me, and I'm lazy.  And unfortunately, perl lends itself extremely well to shortcuts ($_) and laziness.  Python, on the other hand, doesn't.  Maybe it's because of the forced-indents, built-in support for docstrings and object-oriented emphasis, but the code I write in python is by its nature more self-documenting and maintainable when I have to come back to it years later.   And because of that I've found myself over the years reaching more and more for python.  Anything that I think I'll need to come back to years later or anything I think I may need to extend down the line, I now reach for python.   Quick and dirty and throw-away, I go with perl.   It's not a fault with perl.  It's my own shortcoming.  Perl doesn't force good behavior and for me python lends itself to better programming practice.

Having been in both communities, the python community feels more like a community of programmers and scientists.   The perl community feels more like a mix of programmers and sysadmins.   And I think that's likely because perl is so unix-y-- with it's support for piped stdin and stdout.   It excels at that.  And when I do write perl nowadays, I typically do it for that specific reason.  Text-processing on a pipe-- you can't beat perl for how well it lends itself to that.   Python because of it's numpy, pandas, ipython notebook and anaconda frameworks seems to have a better foothold in the scientific data analysis communities.   It attracts folks coming from R that want something a little more general-purpose.

Both are great languages and have incredibly large libraries.  CPAN used to be a huge selling point for perl and was an area where python used to lag behind.   But the python community got it's act together and centralized with PyPi and over the years python has pretty much caught up.  

I agree with pepr with regards to learning a programming language.  If I had the choice, I wouldn't start with nor recommend perl as a first language.   It's way too easy to be a bad programmer in perl.  Python teaches you better habits.   But if your company uses perl, then obviously go with perl.  You can't go wrong with either.   They are both incredibly useful tools.  But do yourself (and those that follow you) a favor and whichever you choose, document your code and write unit tests to further document.   It's hell to go back to code you wrote five or ten years ago and think wtf was I doing with this.   And that's code you wrote yourself.
2

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A set of related code is known to be a Module, it helps us to organize our code logically which is much easier for us to understand and use it. Module is an object with arbitrarily named attributes which can be used in binding and referencing. …
Article by: Swadhin
Introduction of Lists in Python: There are six built-in types of sequences. Lists and tuples are the most common one. In this article we will see how to use Lists in python and how we can utilize it while doing our own program. In general we can al…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now