On Thu, Jun 12, 2003 at 09:48:31AM -0400, Chun Kit Edwin Lau wrote: } In what situation does ppl normally use shell script and when } when will ppl use Perl? How about their performance like speed and also } the ease of programming?
You probably didn't know it, but this is a good way to start a religious war. Perl is a tool, and like all tools it has its niche. Unfortunately, its niche overlaps with numerous standard unix tools' niches. Furthermore, its philosophy of "there's more than one way to do it" (which usually means there are several dozen ways), its use of implicit arguments, and its overuse of punctuation characters tend to make most perl code nearly as unreadable as Intercal. This makes maintaining any substantial chunk of perl code a misery. Assuming the application is small enough (and you were asking about shell scripts so we'll assume it is), however, perl is still best at some things, 1) Processing text, and your processing is not line- or record-based. 2) Manipulating non-ascii (binary) data. 3) Networking combined with processing, though socket and netcat make it reasonable to do a lot of this with a shell script. Other than that, tools like tr, sed, and awk strung together in a shell script tend to be better choices. Let me add one more detail: anyone who is about to write a shell script should read this page http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ Some of it is outdated, but the majority of it still applies. The short version: scripts should use /bin/sh. } Edwin ERTW Lau --Greg -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]