LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-18-2016, 02:11 PM   #1
doughyi8u
Member
 
Registered: Apr 2010
Posts: 254

Rep: Reputation: 10
python vs perl


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?
 
Old 02-18-2016, 02:36 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
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.
 
Old 02-18-2016, 02:46 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,222

Rep: Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319
Quote:
Originally Posted by doughyi8u View Post
What's the pros and cons of each language?
This is a religious issue. Can you think of what pros and cons would matter to you?

I can think of one "pro" for Python that might matter to you: if you choose it over Perl, then you can ask for help from me.

Last edited by dugan; 02-18-2016 at 02:52 PM.
 
1 members found this post helpful.
Old 02-18-2016, 02:46 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938
Meh ...

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.
 
1 members found this post helpful.
Old 02-18-2016, 07:37 PM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
ditto to the above right tool for the job
 
Old 02-20-2016, 03:20 AM   #6
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
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!

HMW
 
Old 02-20-2016, 03:34 AM   #7
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,860
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
These two languages are actually three: Perl, Python and Python3
 
Old 02-20-2016, 08:46 AM   #8
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,222

Rep: Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319
Quote:
Originally Posted by NevemTeve View Post
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.

Also, Perl 6 isn't backward compatible either.

Last edited by dugan; 02-20-2016 at 09:23 AM.
 
Old 02-20-2016, 09:39 AM   #9
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,860
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
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))

Last edited by NevemTeve; 02-20-2016 at 09:41 AM.
 
Old 02-20-2016, 02:21 PM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938
... 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.
 
Old 02-26-2016, 07:20 PM   #11
Rinndalir
Member
 
Registered: Sep 2015
Posts: 733

Rep: Reputation: Disabled
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.
 
Old 02-27-2016, 04:27 PM   #12
YesItsMe
Member
 
Registered: Oct 2014
Posts: 915

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
Quote:
Originally Posted by doughyi8u View Post
I'm curious as to what people think about these two languages.
I have used Perl (5) and Python (2 and 3) for different projects and I can say that Python's lack of brackets hurts my eyes.
 
Old 02-28-2016, 12:32 PM   #13
David.Feldman
LQ Newbie
 
Registered: Dec 2015
Posts: 18

Rep: Reputation: Disabled
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.
 
Old 02-29-2016, 06:20 PM   #14
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,222

Rep: Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319
Quote:
Originally Posted by David.Feldman View Post
I can say that Python appears to be more popular today then Perl. And PHP more popular than either.
Python and Perl aren't only used for server-side web development.
 
Old 03-03-2016, 11:03 AM   #15
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Python related: How to access a Perl script behind a firewall from Python? vxc69 Programming 8 12-14-2010 07:32 AM
Perl Vs python knockout_artist Linux - Newbie 6 10-15-2008 11:06 AM
Perl and Python raghuveerbabu Programming 10 08-24-2007 08:45 AM
Perl or Python JJX Programming 4 04-17-2006 02:42 PM
Python or Perl? Boby Programming 2 06-12-2005 10:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration