LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   which is better perl or shell (https://www.linuxquestions.org/questions/linux-newbie-8/which-is-better-perl-or-shell-702894/)

dnyanesh.3 02-07-2009 02:45 AM

which is better perl or shell
 
Hi,

I want to learn sripting language,which will be the better perl or shell.

thanking you.

Didier Spaier 02-07-2009 02:54 AM

If you want to administrate your system, begin with the Advanced Bash-Scripting Guide from Mendel Cooper. You will find many other resources on The Linux Documentation Project website.

arizonagroovejet 02-07-2009 04:42 AM

Depends on what you want to do. Both have their uses. I've been using/administering Linux for years and know virtually no perl as I've always found that scripts I want to write can be done in using bash and the built tools (cat, sed, tax, awk, tr, etc)

The one time I used perl recently was where I needed to parse some xml.

GibsoneanNode 02-09-2009 02:25 PM

I am not a programmer so take my advice with faint regard.

dnyanesh.3, I don't suppose you would phrase the question as you did, narrowing the choices down to two, if you hadn't already considered first a broader pool of options?

I comment on this because I found Perl's syntax to be cryptic and the learning of it slow going, at some point unfortunately I stopped trying to learn it. You might take to learning Python, which reads more like spoken language, with greater ease than Perl. Just as arizonagroovejet indicated the programming language that is right for you might be narrowed down by knowledge of your purpose in using it, but I don't think you've disclosed that. Will this be your first programming language?

I am only now just starting to learn Python myself but I feel as though this should have been my starting place with scripting alongside the Bash shell. There are many differences between the scripting languages beyond one's ability to grasp a particular language readily, such differences are noted in some threads I've read recently. I felt Su-Shee's comments in the thread Lisp, Ruby, or python were very insightful, also consider reading I want to script and Which scripting language to learn.

For Python resources consider a page of the Python Wiki.

Good luck with your hunting and I hope you enjoy the language you choose!

Poetics 02-09-2009 04:49 PM

For my own two cents, I know little bash scripting (a deficiency I hope to correct soon), but have been hacking along with perl for some time. Both are powerful, and very configurable, and you'll find individuals on both sides of the argument, I've found it really does come down to personal preference. Perl's syntax makes sense to me (not that bash's doesn't), and I enjoy it's modular customizability.

chrism01 02-09-2009 07:03 PM

Well, bash is the shell you login with, so it makes sense to know that language. You can also call awk/sed etc as mentioned.
However, it is interpreted and it can get pretty fiddly/messy if you want to do longer/more complex programs.
See the link in post #2

This is where Perl comes in. Its compiled-on-the-fly and its got the same capabilities as C, but easier to program, with about 80-90% the speed. You don't have to shell out to do stuff, so its a more 'integrated' lang.
Ideally you'd learn both, so you have the right tool for the job.

http://perldoc.perl.org/
http://www.perlmonks.org/?node=Tutorials

roy_lt_69 02-10-2009 12:27 AM

Start off with learning bash.
But be aware that if you plan on doing more complex scripting you may have to learn other languages to extend bash, eg awk, sed, etc.
Perl is rather cryptic, but it has a rich command set and accompanying library to extend it.
It is a full blown computer programming language (with all the bells and whistles) that is great for doing complex administration stuff!
Also Perl will be more portable between *nix flavours compared to bash which can differ!

kauuttt 02-10-2009 02:49 AM

Based on self experience:-
start with bash...when I learnt scripting some years back.I found bash more aesy going (though that depends from person to person)...Now I am comfortable with perl..but that time learning perl was hectic, atleast to me as compare to me.

-cheers-
kd

dnyanesh.3 02-11-2009 06:11 AM

Quote:

Originally Posted by kauuttt (Post 3438090)
Based on self experience:-
start with bash...when I learnt scripting some years back.I found bash more aesy going (though that depends from person to person)...Now I am comfortable with perl..but that time learning perl was hectic, atleast to me as compare to me.

-cheers-
kd

thanks


All times are GMT -5. The time now is 06:51 PM.