LinuxQuestions.org
Review your favorite Linux distribution.
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 01-23-2011, 09:19 PM   #16
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244

Quote:
Originally Posted by binary_pearl View Post

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 ).
it can be used to create OO programs using classes/inheritance and all that OO jazz. but there is also nothing stopping you to write programs in a "procedural" way, such as what you do in scripting. Python can be used to do a lot things besides the ones you mentioned. however, as a beginner language, its still better than Perl. The benefits are apparent especially when OP reaches the level when he needs to learn OO. Perl OO is, ermm, well.....


Quote:
Perl code can get ugly if the script gets too large.
at least you are not in denial. its commendable

Quote:
python may inherently be able to handle this situation better.
its not "may inherently". Its "definitely".
 
Old 01-23-2011, 10:14 PM   #17
binary_pearl
Member
 
Registered: Jul 2007
Location: Chicago Illinois
Distribution: SLES 10 SP2/SP3, SLES 11 SP1, OpenSUSE, Sabayon, Gentoo, Fedora 14, RHEL 3/4/5/6
Posts: 98
Blog Entries: 3

Rep: Reputation: 23
I have a 2000+ line perl script to manage gzipping and sending 18 virtual disks for 4 virtual machines to 6 different staging servers...all which have to be in different directory locations. It's all menu based using ANSI color modules, and generally pretty easy to use. But it sucks to the person who gets to maintain it after I'm gone. Such questions like, why are there 10 hashes all with the same key?, and why the **** is he using xor operators on these variables? I have comments where I can but still it's got to be quite daunting to figure out what was going through my mind at the time, especially if I'm not around to answer questions. It's one of those scripts that had to be done, and I just got so engrossed in it. But deep in development I had to think...hmm is this the situation where all of the python programmers are bragging that it's better for?

But to knock on python, indenting is the not way to indicate the next flow of logic...perl has 1UP on python in that regard

--Shaun

Last edited by binary_pearl; 01-23-2011 at 10:19 PM. Reason: typos and other thoughts; yay for drinking and posting!
 
Old 01-24-2011, 12:03 AM   #18
ajeesh.tr
Member
 
Registered: Jan 2011
Posts: 37

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by alpha01 View Post
Ruby

Enough said :-)
Am confused now, after reading the responses i felt i will go for Python...Ruby???? am hearing it for the first time wot should i do???
 
Old 01-24-2011, 12:04 AM   #19
ajeesh.tr
Member
 
Registered: Jan 2011
Posts: 37

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by binary_pearl View Post
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
The problem i want to solve is to validate a XML file for its syntax..so which language do you suggest.
 
Old 01-24-2011, 12:10 AM   #20
prodev05
Member
 
Registered: Jul 2009
Location: Planet Earth
Distribution: Unix & Linux Variants
Posts: 304

Rep: Reputation: 20
Go for python.
 
Old 01-24-2011, 12:34 AM   #21
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by binary_pearl View Post

But to knock on python, indenting is the not way to indicate the next flow of logic...perl has 1UP on python in that regard
indenting is a good habit, no matter which language. difference is, some (those who just beginning for example) don't indent whatsoever. Python just enforce that good habit, that's all.
 
Old 01-24-2011, 12:36 AM   #22
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by ajeesh.tr View Post
The problem i want to solve is to validate a XML file for its syntax..so which language do you suggest.
Python + lxml. One example here. Search yourself on the internet for more.
 
Old 01-24-2011, 12:39 AM   #23
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by ajeesh.tr View Post
Am confused now, after reading the responses i felt i will go for Python...Ruby???? am hearing it for the first time wot should i do???
forget about Ruby for a while (they are both similar, but Python is more "established"). Just go with Python. After that, you can play with Ruby all you like.
 
Old 01-24-2011, 01:19 AM   #24
ajeesh.tr
Member
 
Registered: Jan 2011
Posts: 37

Original Poster
Rep: Reputation: 0
Wink

Quote:
Originally Posted by ghostdog74 View Post
forget about Ruby for a while (they are both similar, but Python is more "established"). Just go with Python. After that, you can play with Ruby all you like.
Thank you all going ahead with Python...
 
Old 01-24-2011, 01:44 AM   #25
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by ajeesh.tr View Post
The problem i want to solve is to validate a XML file for its syntax..so which language do you suggest.
How about PHP? Check this out: http://php.net/manual/en/book.xmlreader.php
I found PHP easier to catch up than Python!
 
Old 01-24-2011, 02:51 AM   #26
prodev05
Member
 
Registered: Jul 2009
Location: Planet Earth
Distribution: Unix & Linux Variants
Posts: 304

Rep: Reputation: 20
Go for python
 
0 members found this post helpful.
Old 01-24-2011, 10:06 PM   #27
binary_pearl
Member
 
Registered: Jul 2007
Location: Chicago Illinois
Distribution: SLES 10 SP2/SP3, SLES 11 SP1, OpenSUSE, Sabayon, Gentoo, Fedora 14, RHEL 3/4/5/6
Posts: 98
Blog Entries: 3

Rep: Reputation: 23
No love for perl in this tread

Quote:
indenting is a good habit, no matter which language. difference is, some (those who just beginning for example) don't indent whatsoever. Python just enforce that good habit, that's all.
Indenting need not be a syntax error. This reminds me of my mainframe days with cobol, where every line had to start at a specific column. Yay for punch card emulation.

For new programmers, teachers and tutorials should emphasize code style early on. It's not the language's responsibility to teach people correct form. It's the responsibility of those who have learned what to do and not to do to teach those what to do.

My environment may be different than a lot of people's because everything we do is ad-hoc and ultra fast paced. Sometimes I may only get 30 seconds here and there to try to code something before I get interrupted. So If I write a block a code, it has to work. I may not get a chance to fix it unless it breaks in production. I have to live by the motto: "Fire, forget and hope the hell nothing breaks". Not saying that it's the way it should be...but it is what it is. So the the more free-form the language is, the better chance I have of getting a script working in the very limited time I have.

I'm not so much knocking python (except for the indenting thing ), more of justifying the use case for perl. python has advantages, which have been basically summarized earlier is this tread. Each language has it's niche and purpose. Perl is part of what has kept me employed the last 4 years, and I have crafted some really cool, life saving, and amazing scripts with it.

The important thing though is that ajeesh.tr (original poster) was able to have his question answered. The overwhelming response is that python is the way to go. But there may be someone down the line who sees this thread several years later, and their use-case happens to be similar to what I have posted about. I have had several incidents where a post from lets say 2003 made the difference between a go or no-go decision on whether to convert 7000 servers or stop it completely.

If people can benefit from this thread, whether it be now or many years down the line, that's my goal. I hope that the next person asking about perl vs python can help make their decision based upon the information in this tread.

--Shaun
 
1 members found this post helpful.
Old 01-24-2011, 10:34 PM   #28
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by binary_pearl View Post
Indenting need not be a syntax error. This reminds me of my mainframe days with cobol, where every line had to start at a specific column. Yay for punch card emulation.
For new programmers, teachers and tutorials should emphasize code style early on. It's not the language's responsibility to teach people correct form. It's the responsibility of those who have learned what to do and not to do to teach those what to do.
sure, you can teach and tell people to indent, but still , some people don't. Or some does it another way , or some indents too much , or blah blah various other reasons. It is always a bonus if the language enforces such rules, there will not be any ambiguities.

Quote:
So the the more free-form the language is, the better chance I have of getting a script working in the very limited time I have.
the more free form you have, the more chances of people who are not used to those forms to get confused by your code.

Quote:
I'm not so much knocking python (except for the indenting thing ), more of justifying the use case for perl. python has advantages, which have been basically summarized earlier is this tread.
Both Perl and Python have their advantages , that's true i agree. However, Python's advantages outweigh Perl's

Quote:
Each language has it's niche and purpose. Perl is part of what has kept me employed the last 4 years, and I have crafted some really cool, life saving, and amazing scripts with it.
I am sure those can be crafted with Python, with much easier to read code, both for yourself and your successors

Quote:
I hope that the next person asking about perl vs python can help make their decision based upon the information in this tread.
The answer is always going to be the same ( which one is a better beginner language) , Python.
 
2 members found this post helpful.
Old 01-25-2011, 04:57 AM   #29
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Quote:
Originally Posted by ghostdog74 View Post
The answer is always going to be the same ( which one is a better beginner language)
perl - if you like speed and efficiency.

if you can't read perl code, try VB.
 
Old 01-25-2011, 07:47 AM   #30
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by ajeesh.tr View Post
The problem i want to solve is to validate a XML file for its syntax..so which language do you suggest.
Huh ? I.e. don't reinvent the wheel.

Take any standards compliant XML parser and run your XML file through it.

Of course, Perl has XML parsers, and some of them are based on fast "C"-based parser. Try http://search.cpan.org/search?query=XML+parser&mode=all .
 
  


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
What to learn?.. HuMmMm.. Python? Perl? jhyland87 Programming 20 03-04-2010 02:11 PM
What is easier to learn/setup GRsecurity or SELinux? (OT) avalonit Linux - Security 5 11-16-2009 09:46 AM
What is easier to learn/setup GRsecurity or SELinux? abefroman Linux - Security 10 11-15-2009 07:38 AM
Documents to learn C language and Perl/python satimis Programming 5 03-19-2004 10:20 AM
How hard is it to learn gentoo? Easier than RH? silverbullet Linux - Newbie 3 11-29-2003 02:22 PM

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

All times are GMT -5. The time now is 03:53 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