home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / perl / 5903 < prev    next >
Encoding:
Text File  |  1992-09-13  |  7.2 KB  |  139 lines

  1. Newsgroups: comp.lang.perl
  2. 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
  3. From: inc@tc.fluke.COM (Gary Benson)
  4. Subject: Why Bother To Learn Perl?
  5. Message-ID: <1992Sep13.175035.5623@tc.fluke.COM>
  6. Keywords: why,bother,to,learn,perl,?
  7. Organization: John Fluke Mfg. Co., Inc., Everett, WA
  8. Date: Sun, 13 Sep 1992 17:50:35 GMT
  9. Lines: 128
  10.  
  11. Co-workers of Chi-Sharn Wu ask:
  12.  
  13. >  I use ksh/awk/sed very well, why bother to spend a lot of time to learn Perl?
  14. >  What's the real advantages of perl over ksh/awk/sed ?
  15.  
  16. Mail bounced, so I am posting my reply.
  17.  
  18. Others have already written eloquently about the advantages of perl, and by
  19. now, you have more than enough ammunition to convince even the most ardent
  20. awk-er or shell-guy to go perl. But I'd like to add my perspective because
  21. I think I come from a slightly different background than many of those who
  22. have posted their replies, and yet my conclusion is the same: Perl is a
  23. wonderful tool that encapsulates all the best things of the shells, awk,
  24. sed and so on, leaves their bad habits behind, extends them, and normalizes
  25. them into cohesion.
  26.  
  27. I am not a "programmer". I am a technical writer by training and job
  28. experience, but I got drafted to do some programming because our department
  29. had so many things to do that required automation, and no one in the group
  30. knew how to do them. Perl arrived on the scene at the exact moment that we
  31. needed MASSIVE programming, and it was starting to look like we would not
  32. survive if we didn't get up to speed FAST.
  33.  
  34. At the time, I was writing c-shell scripts that usually needed an assist from
  35. awk or sed and I was running into problems all the time. I was talking to
  36. our gurus almost every day because I could never keep the variations in
  37. syntax and flow control straight as I went from csh to sed to awk. I wound
  38. up with a bunch of really awful stuff that "worked" but for the life of me I
  39. couldn't understand why half the time, and the parts I *did* understand
  40. seemed hokey. Because they were.
  41.  
  42. The first thing I tried to do with perl was to match a newline. For some
  43. reason, the way to do this simple task had completely eluded me for over a
  44. week, and one of our best software engineers was getting tired of my
  45. continual questions. Usually she sent me to the manual, but even then, she
  46. sometimes had a hard time explaining what the manual page was trying to say.
  47. So one day when I was just totally fed up with trying to get sed to
  48. understand "s/\n//" I tried it in perl. I wrote it just the way it made
  49. sense, and the son-of-a-gun *worked*! The very first time out! I was amazed.
  50. Having struggled for hours to do something that seemed so easy, it was
  51. almost like walking into a dream to find that it really *could* be as easy
  52. as I had imagined.
  53.  
  54. Soon after, I was using the famous "while (<>){" construct to read files in,
  55. check 'em out and send bits hither and yon. It was fun, easy, and deep all
  56. at the same time. I could see that the thinking that went into the language
  57. was crystal-pure, and when I stumbled, I actually learned something instead
  58. of feeling like I had just stubbed my toe, and mom was yelling at me for
  59. being so clumsy.
  60.  
  61. As I needed more and more functionality, I soon became enamoured with the
  62. logical way that associative arrays could let me tuck away bits of related
  63. information for later use, and soon I was into all kinds of things that I
  64. now know simply cannot be done without this beautiful pearl that Larry has
  65. given us. The debugger alone has been worth its weight in gold to me.
  66.  
  67. Along the way, I found that I was not the only person who had fallen in
  68. love. When I needed help, the newsgroup turned out to be the most amazing
  69. collection of helpful people I have ever had the pleasure to have known.
  70. The esprit of this newsgroup is like perl: a little daring and iconoclastic,
  71. sometimes even showing a guerrilla mentality, but thorough, up front,
  72. professional, and totally dedicated to the task at hand.
  73.  
  74. Early on, I tried to pay back some of the assistance that I had gotten from
  75. comp.lang.perl by posting some replies, but by then EVERYONE had learned
  76. about perl and I soon found myself out of my depth again. But I still read
  77. the newsgroup religiously, (ahem), and continue to wonder at this
  78. phenomenon.
  79.  
  80. I don't yet understand how sockets work and interprocess communication is
  81. still elusive, but I have managed to figure out how to do most of things I
  82. needed to do. When I first read "...optimized for scanning arbitrary text
  83. files, extracting information from those text files, and printing reports
  84. based on that information" I was skeptical because I thought that was what I
  85. was trying to do with csh/awk/sed! But the language lives up to its promise,
  86. and today I take that as a given. If perl _only_ did that, it would be enough,
  87. but somehow Larry Wall has managed to make it not just do back-flips and
  88. half-gainers but also built an entire Olympic-level training camp. See the
  89. definition of "toolbox approach" in the glossary of Programming Perl.
  90.  
  91. My latest interest is setuid scripts because that is the only way to do
  92. certain things, and I am finding that this most mysterious and esoteric
  93. sanctum of the computer scientist/priest isn't beyond me either, if I just
  94. keep my camel nearby. I am cautioned appropriately about the risks, but perl
  95. never says no so I keep studying and learning. I keep a copy of "The Book"
  96. at home and at work, and for weeks, it was my only reading.
  97.  
  98. To me, the language and the thinking behind it are marvels. The three great
  99. virtues laziness, impatience, and hubris define an attitude about how people
  100. use computers that is insightful and delightful, all at once. A little bit
  101. of uh-huh, and a whole lot of oh yeah. Larry once said that if he did not
  102. have a family to support, he'd take some time off and make perl into a "real
  103. language". The man's humility is as big as all outdoors.
  104.  
  105. In the Technical Publications Department here at Fluke, perl scripts now are
  106. doing the following:
  107.  
  108.     * Parsing free-form text files and proprietary format table files to
  109.       generate SGML tags for input to a batch processing publication system.
  110.  
  111.     * Installing project files in a CVS repository and managing the CVS
  112.       directory structures within our department archives.
  113.     
  114.     * Scanning MIS datafiles to extract manual-quality parts lists and
  115.       government "provisioning" parts lists.
  116.  
  117. In addition, we have a ton of tools in perl that do a wide variety of tasks,
  118. for example "m2j" converts Macintosh-style line endings to unix and
  119. vice-versa; "s2g" converts binary "shelf" files to SGML and vice-versa;
  120. "gsr" performs a general search and replace function; and we have a couple
  121. of potent cron programs that clean up our directories.  We recently acquired
  122. some SCSI drives for near-line storage, and we mount and unmount them via
  123. perl scripts. All these things were accomplished by a high school gymnast.
  124. Imagine the power that perl must place in the hands of a trained athlete!
  125.  
  126. As I said, I am not a programmer. But because of perl, I play one on TV!
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. -- 
  134. Gary Benson   -_-_-_-_-_-_-_-_-_-inc@sisu.fluke.com_-_-_-_-_-_-_-_-_-_-_-_-_-_-
  135.  
  136.   Do not go gentle into that good night, old age should burn and rave
  137.   at close of day; Rage, rage against the dying of the light.  -Dylan Thomas
  138.  
  139.