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

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.
Taras ShumyloAsked:
Who is Participating?
peprConnect With a Mentor Commented:
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).
foocharConnect With a Mentor Commented:
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...
wilcoxonConnect With a Mentor Commented:
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.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
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.
wilcoxonConnect With a Mentor Commented:
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.
wilcoxonConnect With a Mentor Commented:
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.
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.