ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm curious as to what people think about these two languages. I dont' really know python (I just started learning it) but so far the two languages seem somewhat similar (i.e. split, slice etc).
What's the pros and cons of each language?
I've written a lot of code in each language but have switched almost exclusively to Python for new code.
Perl has an excellent compiler which produces fairly efficient code. It has a huge library of user-contributed code called CPAN, but much of that is unmaintained.
Python has a large standard library of code which is well-maintained. For me, that gives it the edge over Perl.
Start with one. If you stick with this business long enough, you will use all of 'em. Much too many to let you afford to "play favorites."
The Perl language started with what is today a "definitive" implementation of regular expressions, which other implementors promptly (and, quite legally) copied, adapted, or tried to improve upon. You will see a lot of "cross-pollination of ideas" among programming languages, because all of them are "tools for a job" and "the job" tends to need the same sort of power-tools. Regular expressions, splitting, slicing, splicing, database access.
And yet, they are also very different. Python, for instance, is strongly influenced by Common LISP (which, by the way, is one of the "ancient languages," dating back to the beginning of computing and still in widespread use today).
All of them have extensive "contributed libraries" where programmers share their power-tools with one another.
So, I suggest that you do as I do: become a bit of "a student of programming tools." When you hear of a new tool, check it out. (There's almost certain to be a free implementation on Linux.) Notice what it offers, notice how it approaches various problems, and notice what sort of problems it especially seems to focus on. Put that knowledge under your hat because you just never know when you'll need it again.
"Python vs. Perl"=="Wrench vs. Pair-of-Pliers." They are both tools. Nothing more, nothing less. Two [aye, "fine and battle-tested ..."] tools, among very many, of our most-courious trade.
Last edited by sundialsvcs; 02-18-2016 at 06:50 PM.
I guess most of it is a personal preference. I almost never use Perl, not because I don't like it, but because I can do everything in Python. Go with the one you like best!
These two languages are actually three: Perl, Python and Python3
Not really. The difference between Python 3 and 2 is around 1% of the language, and it's fairly common practice these days to write code that works with both.
There is a topic right here about python vs python3... With perl6 it will be four languages... (I don't mind though, I prefer PHP (which has incompatible changes too))
... and a far better way of looking at this "issue" is that, whatever language the system you're walking into was started in, it is most likely to continue in. I've worked on 'em all. A good programmer can write good code in a bad language, and vice-versa.
Pros and cons are in the eye of the beholder. Should we presume you know perl? What do you like about it and why did you learn it?
I will always use perl one-liners for those inevitable one-offs that you encounter. But for anything else I use python.
Too much madness with perl maintainers over the years for my taste.
Also it is easy to write perl code that two months later you can't understand it.
There are plenty of problems with python but so far it has not been too crazy.
Correct, it's the right tool for the right job, but not everyone can or wants to become an expert in everything. I prefer PHP myself but mostly just because that's what I know best.
I can say that Python appears to be more popular today then Perl. And PHP more popular than either.
To me, Python's use of indentation is a crippling deficiency, because it's too damn easy to hit the backspace key or the tab key at the wrong moment, and this changes the meaning of the code.
Nevertheless, I worked for many years with a Python-based site that did about $60,000 a day in revenue, hosting hundreds of users with grace and style.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.