Hi,

I understand the advantages of using perl over other shell programming techniques like sh,ksh,bash etc. I understand that perl is very powerful and advanced.

But, here, i want to know, if there is any situation, where in, we prefer to use the usual shell programming over perl? Any performance gain? Or any other advantage? I know that Perl can act in many ways that shell scripts cannot, such as in cgi scripts. But as far as acting on the system and its files, or acting only locally, it seems that shell scripts are more powerful?

Thanks
Nisha

There is pretty much no reason to use shell scripting if you're guaranteed that your environment will have perl, unless that's what you happen to prefer. Except for maybe some really small stuff.

Ten lines of shell script is easier to maintain than 70 lines of perl.
It's also faster to develop.

Experienced sysadmins use shell scripts, then use perl/ruby/python when they cannot do whatever it is in shell coveniently or very well.

In practice what usually happens is that new sysadmins learn one thing really well and use it for everything. eg, perl or ksh. This practice is usually frowned upon in big companies where creating hard to maintain code is frowned upon. Hard to maintain code is what you often get when you push a facility to the very edge of it's capbilities - usually because you don't any other way to do it.

It all depends on what you are trying to do

Sometimes what takes 100 lines in shell to do can be achieved by using a simple perl module !

Sometimes a single bash shell command can do the job for you neatly

so it depends on the usage and user.

This article has been dead for over six months. Start a new discussion instead.