"Esposito, Anthony" <[EMAIL PROTECTED]> writes:

>    How would you convince someone that programming in Perl is better
>    than using the UNIX Korn Shell?

I wouldn't.  I use both.

Here's one argument -- the titles of my reference books for each.

    "Programming Perl", 3rd edition, Wall, Christianson & Orwant
    "Programming Perl", 2nd edition, Wall, Christianson & Schwartz
    "The KornShell Command and Programming Language", Bolsky & Korn

Perl is a programming language.
KornShell is a command language.

KornShell is also a programming language, but I only use the
programming language features as they pertain to a command language.

For me, that means that I use them in tandem: 
 -- Perl is my programming language.
 -- KornShell is my command processing language. 

I use KornShell to glue together my individual tools that I create out
from Perl.

For creating complex data structures, traversing them, and reporting
out, Perl is unlimited. KornShell's "data structures" are limited to
files, lines, and fields. No encapsulation. No inheritance. No
extensible types. In short, KornShell is not a programming language in
any modern sense of the word. But that's OK, it really wasn't meant to
be a complete programming language, only to add enough programming
language concepts to leverage the other parts that it's great at --
I/O redirection, file globbing, variable & command interpolation, job
control, process control, etc -- the kinds of things that are awkward
to do within a Perl program.

Sure, Perl can do scripting.  I just knew enough KornShell to avoid
having to do it in Perl.

Sure, KornShell can do programming. I made my living as a C programmer
at Bell Labs for much of the 80's and 90's by *avoiding* C to do it in
KornShell. (Some would say that I never was a C programmer since I
tried to avoid to so often.) I could get a lot of things done with a
little KornShell gluing together some Unix utilities with and a bit of
KornShell programming language magic. But this architecture it would
only scale so far. After that I'd have to use AWK, but that, too, had
limitations that prevented scaling my applications. I had almost
resigned my programming practice when I found Perl -- an elegant blend
of the strength of a programming language and the flexibility of a
scripting language.

Perl is a real programming language, despite it's original
appellation, often used belittlingly, as a scripting language. With
Perl, I never ran into the limitations I found with Korn or AWK. AWK
is gone from my list of active languages (though I'll maintain an AWK
script in AWK), but Korn and Perl are a great combination.

>    I need some `intellectual ammo' to convince my colleagues that
>    Perl is a better, more powerful language, to do our scripting.
>    Any suggestions?

In summary, Perl is better than KornShell and it isn't.

  Perl is a better *programming* language.
  KornShell is a better *command* language.


Use 'em both.




I hand out a quote card at the beginning of every programming language
class I teach. It's a computer scientist quoting a linguist. (Note
that Larry is *both* -- a useful combination in my mind -- for someone
who's designing a language for both computers and humans.) I use the
quote to launch a discussion that brings in all the other languages
the students have used and how they have used them. By painting a big
picture of the entire programming ecosystem, I then narrow the focus
to what the language-du-jour does well, what it doesn't do well, and
how it complements other languages in the students' repertoire. It
sets the context for the following few days where we concentrate on
one specific language, and it prevents some jihad with chants and
jibes of "my language is better than your language". Perhaps. Better
at what?

        Language shapes the way we think,
        and determines what we can think about.
          -- B. L. Whorf
            -- as quoted in the Preface to the First Edition of
               "The C++ Programming Language", Bjarne Stroustrup

    * If what you're thinking about is data structures, use a
    programming language like Perl (or C, or C++, or the "BASIC" in
    Visual Basic).

    * If what you're thinking about is a GUI, use a GUI tool or
    language (like TK, or the "visual" in Visual Basic).

    * If what you're thinking is rules based, use make or some
    declarative rules-based language.

    * If what you're thinking is business oriented, use COBOL.

    * If what you're thinking is (device driver|security|...) use
    fill-in-the-blank.

I happen to think that most of the problems I tend to solve can be
divided into two separate parts and that Perl and KornShell map nicely
into those two parts -- Korn is the shell that wraps my Perl, which
encapsulated the irritation (i.e. problem or business need).

Enjoy,
Michael

-- 
Michael R. Wolf
    All mammals learn by playing!
        [EMAIL PROTECTED]

Reply via email to