On Wed, Nov 05, 2003 at 04:19:44PM -0500, Esposito, Anthony wrote:
>    How would you convince someone that programming in Perl is better than
>    using the UNIX Korn Shell?
>    I need some `intellectual ammo' to convince my colleagues that Perl is a
>    better, more powerful language, to do our scripting.  Any suggestions?  J

Well... the right tool for the right job, I'd say. If the scripting
you're speaking of is limited to basic filesystem functions, no real
math of any sort, and very simple parsing, then the Korn shell is fine.
When extended with a few tools - "grep", "cat", 'bc", "sed", and "awk" -
Korn is actually quite powerful. However, shell scripts are _very_ slow,
and any loops that process largish amounts of information can get pretty
horrendous. There are endless things you can do with Perl where the
shell would just barely limp along, or simply be unable to accomplish
the job at all, but if your colleagues are seriously trying to compare
the two, then I suspect that the scope of what you're doing probably
does not include those.

As a small comparison, one of my students had a shell script that
processed a pair of files, about 75MB each, by doing _something_ (I
don't remember the exact details) that involved taking a line from file1
and doing something to every line in file2 based on it, then moving down
a line in file1 and repeating the process (note that this was done on
some very fast and powerful Sun hardware.) According to his literally
shell-shocked account on the third morning of a week-long Perl course,
the time to run the script went from over 20 minutes to under 45 seconds
when it was rewritten in Perl. Rewriting, by the way, only took him
about ten minutes - the script was not very complex.

For myself, I've used a mix of Bash and Perl (10/90) to do literally
every scripting task I've needed to accomplish for the past N years (I'm
feeling too lazy to battle my forgettery at the moment. :) I wouldn't
want to be without either one, but if had to, Perl would be the winnah
and champeen.

* Ben Okopnik * okopnik.freeshell.org * Technical Editor, Linux Gazette *
-*- See the Linux Gazette in its new home: <http://linuxgazette.net/> -*-

Reply via email to