On Sat, 4 Dec 1999, Ken Williams wrote: > joel_rees@sannet.ne.jp (Joel Rees) wrote: > >Actually, no. But the scripts my company is (presently) using don't make > >any real use of anything I can perceive as a distinguishing feature of > >Perl. I mean I can do it with fgets(), woops, strchr() and strstr() in > >less lines of C. > > > Here: try posting a short snippet of code here (or reasonable approximation > thereof) that you think is probably shorter in C, and I bet you'll get six or > seven different alternatives in Perl that get the job done concisely and > clearly. Probably more clearly than you anticipate. There will be a range of > elegance and several different styles. You'll pick your favorite, and learn > why Perl programming is more fun than most other programming. > I've done my fair share of C, with a lot of it being text processing using fgets(), pointers, and the various <string.h> functions, and I don't buy for a second the notion that you can write anything half-serious in C to do a string-processing task that isn't faster to write and more concise when written in Perl. I'm not knocking C - it's my core language. But the reason for using Perl over C is not because you can't do it in C. Hell, Perl is written in C - it stands to reason that task A done in Perl can also be done in C. :-) One of my favourites for illustrating when to use what is the following: Write a program to index/search text. It has command-line options for casefolding, various switches for controlling legal characters (alphanumeric only, no numbers etc), strings to search for and where to get them, the usual IO stuff (STDIN or file, STDOUT or file). The program must store the page number, line number and column number of each word indexed. It can handle simple hyphenation, and accept a user defined routine to do word-splitting. When searching it needs to output a properly formatted report. A list of stopwords may also be supplied. Write this program in C and in Perl. Compare. Arved # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org