Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Unix shell versus Perl

by peterdragon (Beadle)
on Feb 18, 2008 at 23:44 UTC ( #668702=note: print w/replies, xml ) Need Help??


in reply to Unix shell versus Perl

I've pretty much given up writing shell scripts longer than 20 lines.

The main reason is error handling. Exceptions, warnings, controlled failures? Forget all that in shell script, one bad error and it fails, no warning, no log.

A secondary reason is portability. Let's take "echo". Depending whether you're on Solaris or AIX or Linux my guess is you're wondering whether to run /bin/echo or builtin echo or echo -e or whatever to get a \n translated to carriage return. Have you ever looked at the shell script behind GNU configure? That says it all, and what it's saying is "should have been written in Perl!".

Okay, backaways when you might have perl4 or perl5.05 or perl 5.06 out of the box with your distro it made sense to use shell for more portability. Since the advent of perl 5.06 the language has been stable enough (more so than sh/csh+Unix of choice) to be preferable.

Regards, Peter
http://perl.dragonstaff.co.uk

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://668702]
help
Chatterbox?
Discipulus a missing semicolon after use LWP::UserAgent caused very strange behaviour and not the normal warning...
[choroba]: Yes, sometimes missing ; after the use clause just interprets the next line somehow and passes the result to the used module which could happily ignore it. Been there, seen that.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2017-02-28 08:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (398 votes). Check out past polls.