LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-10-2010, 12:25 AM   #1
coolgreen1
Member
 
Registered: Nov 2007
Distribution: CentOS 5.5 x86_64 (Desktop) & Linux Mint 9 (Netbook)
Posts: 71

Rep: Reputation: 17
Ruby vs Perl vs Python


Hi,

Which language should I learn? This will be my first language. Right now I am leaning towards Perl. It seems like Perl is the most powerful and flexible of the three. Is this true? I would just like to know of others opinions before I settle though. What are your thoughts and opinions about both.

Any help would be greatly appreciated.
 
Old 12-10-2010, 06:58 AM   #2
T0sh1r0
Member
 
Registered: Oct 2010
Posts: 51
Blog Entries: 1

Rep: Reputation: Disabled
First of all, I prefer python and don't know ruby.

I like python because while you learn the language but also because you learn some good practices about programming (indentation, documentation...). And I love the "battery-included" philosophy.

I tried perl but did not like it: too much shortcuts and tricks. It's true that you can write very very short code but often it makes the code a nightmare to understand (unless you are a perl expert, I guess)

It's just my opinion and so a matter of taste.
You should also look at what you want to do with the language you will learn (perl is very good to parse text for instance)
 
Old 12-10-2010, 09:09 AM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
As in most things, the best tool depends on the job. If you expect to be writing code that will become 'production' code in any sense, then Python might be a better choice. Perl is fantastic as a sysadmin's general purpose tool, and can be used to do almost anything. There are so many subjective aspects to factor into how you evaluate 'goodness', that only you can really decide. These include how you want to use your new skill, how easy/hard it may be to learn the new language, what resources you have at your disposal (books, mentors, computer system resources, prior knowledge & aptitude), and whether you want to achieve mastery of the language, or will be satisfied by simply being able to understand the basics.
To me, too much time is often spent debating which is better, rather than spending time doing actual learning. Once you've mastered one language, learning others is much easier; most of the basic concepts exist in all languages. For a lot of people, the first language can be challenging. You should be prepared to struggle and do a lot of unproductive work in the early going.

--- rod.
 
1 members found this post helpful.
Old 12-10-2010, 01:28 PM   #4
coolgreen1
Member
 
Registered: Nov 2007
Distribution: CentOS 5.5 x86_64 (Desktop) & Linux Mint 9 (Netbook)
Posts: 71

Original Poster
Rep: Reputation: 17
I am looking for a language that can do a mix of things. Like building cli applications to gui applications. Programming will be a hobby, it is not for a job. Is Perl good? It seems like Perl has a very large community. How does Ruby and Python compare? Also, Perl claims to have over 20,000 modules in CPAN. How does that compare to Ruby and Python? Also, is it just me or does Python and Ruby code look very similar.

Last edited by coolgreen1; 12-10-2010 at 01:40 PM.
 
Old 12-10-2010, 02:25 PM   #5
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
If you like Perl, learn that.

Python and Ruby are similar.

The problem with python is backwards compatibility ... python 2 is no longer developed, even tho everyone still uses it, and python 3 is NOT backwards compatible. This is one thing I don't like.

It also depends on what you want to do, but you can hack almost anything in Perl.
 
Old 12-10-2010, 02:45 PM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Also, is it just me or does Python and Ruby code look very similar.
I've never seen you so, I don't know whether you look like a Python or a Ruby.

If you are programming for a hobby, then a major factor in your choice should probably be how much fun you get out of it. That probably involves the satisfaction of quick learning, and Python seems to have a reputation for this. However, if you do already have a strong background with a lot of traditional Unix tools like grep, awk, sed, shell scripting, etc., then Perl may be quicker to pick up.
If my guess is correct, you will have a hard time getting an objective opinion involving a contrast of Perl & Python & Ruby, since they are all substantially similar, and someone who has already mastered one of them will probably not bother to learn the others. I certainly fall into that category.
Perl is probably the most mature of the three languages. However, it was also one of the first of the Swiss-army-knife style of languages, so other languages may have done some things better with the benefit of seeing other implementations. As a hobbyist, you are unlikely to reach a point where you are limited by the language you are using. If you do reach that level, you will by that time have acquired enough knowledge that the choice of a better alternative will be clear.

--- rod.
 
1 members found this post helpful.
Old 12-10-2010, 02:53 PM   #7
coolgreen1
Member
 
Registered: Nov 2007
Distribution: CentOS 5.5 x86_64 (Desktop) & Linux Mint 9 (Netbook)
Posts: 71

Original Poster
Rep: Reputation: 17
After looking at some more code samples I have narrowed it down to Perl or Ruby. Which one of these do you like better and why.
 
Old 12-10-2010, 03:46 PM   #8
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Personally, I like Perl, because I already know it. I use it routinely for both system admin tasks, and for certain production-level purposes. I undertook to learn it because it seemed to turn a lot of special-purpose tools that I already understood reasonably well into one general purpose programming language. At the time, I'd never heard of Ruby, and only a little bit about Python. I've only briefly flirted with Ruby, and only in the context of Ruby-On-Rails, and it didn't look awful from the small amount I tried.

--- rod.
 
Old 12-10-2010, 05:07 PM   #9
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hello coolgreen1,

I'm not an experienced programmer. I came to Linux back in 1994 because I wanted to learn C++, I found Perl instead an learned it very well, but it was the ancient version of Perl-4, without Objects.

The problem with Perl is that if one doesn't use it continuously one cannot understand the code. When I use Perl, I don't understand my own code after a few weeks. Do not missunderstand me, Perl in fact is a great language!

Nowadays I do a little programming at project.euler and for most of the problems I've solved there I used Ruby. Ruby is very "readable" and I find it easy to learn. Since I don't program continuously, I find it very convenient that I can understand my own Rubycode even after one year.

Markus
 
Old 12-10-2010, 05:41 PM   #10
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi, coolgreen1, -

I *hate* questions like "Which flavor is better: chocolate or vanilla?". There's usually no "one, simple answer" to a question like that.

But frankly, based on everything you've said, I honestly think Perl would probably be the best choice here.

IMHO...

PS:
Python would be my second choice. And my first choice if your interest were less "practical" and more "academic" (Python is by far the more "elegant" language). In any case ("practical" OR "academic"), Ruby would have been a distant 3rd.

Last edited by paulsm4; 12-10-2010 at 05:44 PM.
 
Old 12-10-2010, 05:57 PM   #11
coolgreen1
Member
 
Registered: Nov 2007
Distribution: CentOS 5.5 x86_64 (Desktop) & Linux Mint 9 (Netbook)
Posts: 71

Original Poster
Rep: Reputation: 17
Thank you all for your answers. I am going with Perl.
 
Old 12-11-2010, 04:16 AM   #12
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hello coolgreen1,

I'd suggest to read the camelbook http://oreilly.com/catalog/9780596000271
It's written very well and gives a lot of insight into perl as well as Unix/Linux in general.

Markus
 
Old 12-11-2010, 10:45 AM   #13
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 56
I personally think Vala is a good first compiled language, which has plenty of superiority over something that needs an interpreter, which hogs precious CPU and other resources. And Vala compiles directly to C as well, so it doesn't require bytecode or other odd ABIs.

There's also Genie which compiles like Vala but has a syntax similar to Python's.
 
Old 12-12-2010, 07:00 PM   #14
wagaboy
Member
 
Registered: Jun 2010
Distribution: Ubuntu 10.04, Cent OS 5.5, CLE3
Posts: 51

Rep: Reputation: 21
Quote:
Originally Posted by coolgreen1 View Post
Thank you all for your answers. I am going with Perl.
I'm not here to convince you to follow any one path. I want to give you my perspective on these two languages. I was in a similar situation (Ruby wasn't in the picture back then), and I tried both Perl and Python. Started learning the basics of both, and I found Python to be more intuitive to read and understand than Perl. Perl seemed more obscure IMO even though I had a fairly good programming experience in C and Java.

Last edited by wagaboy; 12-12-2010 at 07:02 PM.
 
Old 12-12-2010, 09:54 PM   #15
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
Ruby is newer and more up and coming, perl has been around for a long time, and will be around for a long time more, and perl will probably work better for shell scripts.
 
  


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
Perl vs. Ruby vs. Python vargadanis Programming 53 12-31-2010 12:37 PM
Perl or Ruby or Python? Or something else? MasterOfTheWind Programming 18 05-07-2009 12:43 PM
LXer: Basics 101: ruby python bash perl expect php, How do the exact same thing in th LXer Syndicated Linux News 0 10-05-2008 06:00 AM
Haskell, OCaml, Scheme, Erlang, Perl, Python, Ruby manolakis Programming 8 08-06-2007 10:10 PM

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

All times are GMT -5. The time now is 06:59 AM.

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