[81] in Back_Bay_LISA
Re: To perl or not to perl?
daemon@ATHENA.MIT.EDU (Tom Fitzgerald)
Thu Nov 19 21:37:18 1992
From: Tom Fitzgerald <fitz@wang.com>
To: bblisa@inset.com
Date: Thu, 19 Nov 92 19:57:34 EST
In-Reply-To: <9211191843.AA22644@relay1.UU.NET>; from "Andrew Kobayashi" at Nov 19, 92 11:54 am
For me, perl has gone from 'interesting' to 'useful' to 'essential'. I've
got dozens of quickie perl scripts, run either from the command line, or as
TCP/IP daemons, cron jobs or whatever, that I couldn't do without. I'd
hate to do the same things in sh, even if I know that it's possible.
We've got
- A replacement for the finger daemon, that searches an online list of all
Wang employees for substring matches. "finger kirk@das.wang.com" for a
demo. It's terribly slow because I haven't added hashing yet - it greps
a 14,000-line directory to find matches.
- A utility to read the UUCP logs and tell me about UUCP connections: who,
when, how long, which tty, and how many mailmessages and newsbatches were
transferred:
shyoon 11/18 13:40:56 0:00:08 [1m->] tty1B
shyoon 11/18 14:13:59 0:00:20 [1m->1m] tty1B incoming
shyoon 11/18 20:41:05 0:00:05 [1m->] tty1B
shyoon 11/18 22:13:46 0:00:04 [->1m] tty1B incoming
shyoon 11/19 0:13:54 2:50:58 [1m80n->] tty1B incoming
shyoon 11/19 11:41:59 0:00:07 [1m->] tty1B
shyoon 11/19 13:41:05 0:00:18 [2m->] tty1B
- A cron-job to crunch the sendmail logs and send mail to my boss, who
LOVES building graphs of this stuff:
Messages KBytes
Wang LANs -> Outside 878 3017
Outside -> Wang LANs 1351 4549
Pass-through 262 2314
Number of distinct addresses:
Senders Receivers
Outside 615 634
Wang Lans 79 109
Queue delay: Msg count
0-5 seconds 101
5-15 seconds 2981
15 sec - 1 min 1487
1-5 minutes 290
All of these are possible in sh or C, but they're far too ugly in sh, and
take too long to write in C. These were all 8-hour hacks, most of which
was spent in rethinking what I wanted them to do.
The perl is moderately readable too. As one person commented, it's
possible to write readable perl; it's also possible to write horribly
unreadable perl, sh or C. The discipline you need is independent of
the language you're writing in.
It's certainly an ugly language. I *despise* having to name all my
variables beginning with a '$', not having arrays-of-arrays, and not being
able to pass multiple arrays to a subroutine. Tight perl code tends to
look like TECO. It's worth it to me - the code is FAST to write, performs
well enough, is portable across all the systems I need to deal with, and
easy enough to modify.
If you already know C, awk, sh and sed, then perl is pretty quick to learn.
--
Tom Fitzgerald Wang Labs fitz@wang.com "I went to the universe today;
1-508-967-5278 Lowell MA, USA It was closed...."
--
Send mail for the `bblisa' mailing list to `bblisa@inset.com'.
Mail administrative requests to `bblisa-request@inset.com'.