Perl vs Python which is easier to learn
i want to learn a scripting language,which one should i go for ,among perl and python.
|
Python is better for you. It learns good looking code.
|
Quote:
|
the python website?
http://wiki.python.org/moin/BeginnersGuide |
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
|
Quote:
http://www.diveintopython3.org/ |
Quote:
And you haven't touched the features yet - Python is slowly catching up with Perl (e.g. closures are there, but not yet lexical scope and anonymity). |
Quote:
Code:
>>> s="a string" Perl is ugly by default. Excessive use of $,%, @ to denote array/hashes and variables. Quote:
FWIW, I would even recommend Ruby instead of Perl if OP has a choice between another language besides Python. |
I'm not an expert but this may help.
It looks like you either want an easy to learn and get started with interpreted language that is common or one that is much, much more involved.
You are going to discover that there are a couple of languages you want to learn and then there are the ones that you end up learning. Python is recommended as being easy to learn and is held in high reguards by hackers.More Hackers choose to hack with Python. There are plenty of intentionally comprehensive guides and tutorials for Phython as well. Perl is more involved and you can do more with it but you are not going to automatically benefit by just trying to learn Perl and hit two birds with one stone. I don't think that Perl is recommended as a first language. If you can't get it done with Bash why not think of Java script? It's popular ,it's Linux and it's interpreted. Python was the first Language I studied and I pretty much learned close to nothing compared to C with it. Python is a way more higher of a Language than C. For a first Language I don't think Pascal should be overlooked but I think the common versions are compiled. There probably was a interpreted version of it at one time. I personally would not recommend a OOP language for a first Language because you won't realize how ridiculously abstracted OOP is. |
Quote:
|
Quote:
Of course, $,%, @ are helpful - they help to understand what kind of thing it is Code:
s[1:-1].replace("s","S")[0:-2] In Perl: Code:
sergei@amdam2:~/junk> perl -e '$s = "a string";warn do{$s=~s/s/S/;substr($s, 1, 4)};' |
http://blogs.perl.org/users/jeffrey_...with-perl.html - and a recent thread in this forum about things working in earlier Python version, but not a later one - I read about Python regularly breaking things elsewhere.
|
Quote:
Quote:
Quote:
Quote:
|
Quote:
Enough said :-) |
It really depends on the problem that you are trying to solve. I find learning a language for the sake of learning a language is not an effective way to remember it. It's more effective to use a language to solve a particular problem. If you don't have a specific problem...create one ;) Maybe there are tasks you want to automate with getting input from a web site, or maybe you are looking to parse output to do something with it.
perl is my main weapon of choice, because my job is heavily based on local, server-side scripting. perl allows me to develop scripts rapidly; from configuring networking to watching VM's go down, to parsing output from many different commands. This is especially useful when only about 5% of my day can be spent on coding. python, I haven't used as much, but my understanding is that it's more suited for object oriented programming and possibly web programming. (I'll let the python advocates speak more to this ;) ). Perl code can get ugly if the script gets too large. python may inherently be able to handle this situation better. Debating the subtle semantics of the languages though isn't going to help the original poster decide which language to use. The best thing is identify what the poster wanted to solve, and then give them suggestions on which language would be best to use. One that's determined, it's probably best to go to google and type "$language tutorial" and start following a tutorial to start learning the language in question. --Shaun |
All times are GMT -5. The time now is 08:49 AM. |