home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!uakari.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!uw-beaver!fluke!inc
- From: inc@tc.fluke.COM (Gary Benson)
- Subject: Why Bother To Learn Perl?
- Message-ID: <1992Sep13.175035.5623@tc.fluke.COM>
- Keywords: why,bother,to,learn,perl,?
- Organization: John Fluke Mfg. Co., Inc., Everett, WA
- Date: Sun, 13 Sep 1992 17:50:35 GMT
- Lines: 128
-
- Co-workers of Chi-Sharn Wu ask:
-
- > I use ksh/awk/sed very well, why bother to spend a lot of time to learn Perl?
- > What's the real advantages of perl over ksh/awk/sed ?
-
- Mail bounced, so I am posting my reply.
-
- Others have already written eloquently about the advantages of perl, and by
- now, you have more than enough ammunition to convince even the most ardent
- awk-er or shell-guy to go perl. But I'd like to add my perspective because
- I think I come from a slightly different background than many of those who
- have posted their replies, and yet my conclusion is the same: Perl is a
- wonderful tool that encapsulates all the best things of the shells, awk,
- sed and so on, leaves their bad habits behind, extends them, and normalizes
- them into cohesion.
-
- I am not a "programmer". I am a technical writer by training and job
- experience, but I got drafted to do some programming because our department
- had so many things to do that required automation, and no one in the group
- knew how to do them. Perl arrived on the scene at the exact moment that we
- needed MASSIVE programming, and it was starting to look like we would not
- survive if we didn't get up to speed FAST.
-
- At the time, I was writing c-shell scripts that usually needed an assist from
- awk or sed and I was running into problems all the time. I was talking to
- our gurus almost every day because I could never keep the variations in
- syntax and flow control straight as I went from csh to sed to awk. I wound
- up with a bunch of really awful stuff that "worked" but for the life of me I
- couldn't understand why half the time, and the parts I *did* understand
- seemed hokey. Because they were.
-
- The first thing I tried to do with perl was to match a newline. For some
- reason, the way to do this simple task had completely eluded me for over a
- week, and one of our best software engineers was getting tired of my
- continual questions. Usually she sent me to the manual, but even then, she
- sometimes had a hard time explaining what the manual page was trying to say.
- So one day when I was just totally fed up with trying to get sed to
- understand "s/\n//" I tried it in perl. I wrote it just the way it made
- sense, and the son-of-a-gun *worked*! The very first time out! I was amazed.
- Having struggled for hours to do something that seemed so easy, it was
- almost like walking into a dream to find that it really *could* be as easy
- as I had imagined.
-
- Soon after, I was using the famous "while (<>){" construct to read files in,
- check 'em out and send bits hither and yon. It was fun, easy, and deep all
- at the same time. I could see that the thinking that went into the language
- was crystal-pure, and when I stumbled, I actually learned something instead
- of feeling like I had just stubbed my toe, and mom was yelling at me for
- being so clumsy.
-
- As I needed more and more functionality, I soon became enamoured with the
- logical way that associative arrays could let me tuck away bits of related
- information for later use, and soon I was into all kinds of things that I
- now know simply cannot be done without this beautiful pearl that Larry has
- given us. The debugger alone has been worth its weight in gold to me.
-
- Along the way, I found that I was not the only person who had fallen in
- love. When I needed help, the newsgroup turned out to be the most amazing
- collection of helpful people I have ever had the pleasure to have known.
- The esprit of this newsgroup is like perl: a little daring and iconoclastic,
- sometimes even showing a guerrilla mentality, but thorough, up front,
- professional, and totally dedicated to the task at hand.
-
- Early on, I tried to pay back some of the assistance that I had gotten from
- comp.lang.perl by posting some replies, but by then EVERYONE had learned
- about perl and I soon found myself out of my depth again. But I still read
- the newsgroup religiously, (ahem), and continue to wonder at this
- phenomenon.
-
- I don't yet understand how sockets work and interprocess communication is
- still elusive, but I have managed to figure out how to do most of things I
- needed to do. When I first read "...optimized for scanning arbitrary text
- files, extracting information from those text files, and printing reports
- based on that information" I was skeptical because I thought that was what I
- was trying to do with csh/awk/sed! But the language lives up to its promise,
- and today I take that as a given. If perl _only_ did that, it would be enough,
- but somehow Larry Wall has managed to make it not just do back-flips and
- half-gainers but also built an entire Olympic-level training camp. See the
- definition of "toolbox approach" in the glossary of Programming Perl.
-
- My latest interest is setuid scripts because that is the only way to do
- certain things, and I am finding that this most mysterious and esoteric
- sanctum of the computer scientist/priest isn't beyond me either, if I just
- keep my camel nearby. I am cautioned appropriately about the risks, but perl
- never says no so I keep studying and learning. I keep a copy of "The Book"
- at home and at work, and for weeks, it was my only reading.
-
- To me, the language and the thinking behind it are marvels. The three great
- virtues laziness, impatience, and hubris define an attitude about how people
- use computers that is insightful and delightful, all at once. A little bit
- of uh-huh, and a whole lot of oh yeah. Larry once said that if he did not
- have a family to support, he'd take some time off and make perl into a "real
- language". The man's humility is as big as all outdoors.
-
- In the Technical Publications Department here at Fluke, perl scripts now are
- doing the following:
-
- * Parsing free-form text files and proprietary format table files to
- generate SGML tags for input to a batch processing publication system.
-
- * Installing project files in a CVS repository and managing the CVS
- directory structures within our department archives.
-
- * Scanning MIS datafiles to extract manual-quality parts lists and
- government "provisioning" parts lists.
-
- In addition, we have a ton of tools in perl that do a wide variety of tasks,
- for example "m2j" converts Macintosh-style line endings to unix and
- vice-versa; "s2g" converts binary "shelf" files to SGML and vice-versa;
- "gsr" performs a general search and replace function; and we have a couple
- of potent cron programs that clean up our directories. We recently acquired
- some SCSI drives for near-line storage, and we mount and unmount them via
- perl scripts. All these things were accomplished by a high school gymnast.
- Imagine the power that perl must place in the hands of a trained athlete!
-
- As I said, I am not a programmer. But because of perl, I play one on TV!
-
-
-
-
-
-
- --
- Gary Benson -_-_-_-_-_-_-_-_-_-inc@sisu.fluke.com_-_-_-_-_-_-_-_-_-_-_-_-_-_-
-
- Do not go gentle into that good night, old age should burn and rave
- at close of day; Rage, rage against the dying of the light. -Dylan Thomas
-
-