[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] what's it look like under the hood?



At 12:38 PM -0400 12/4/99, Arved Sandstrom wrote:
>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.
>

...

>
>Write this program in C and in Perl. Compare.

 From a different perspective, I've done a lot of shell programming 
and image processing using C and other languages over the last 15 
years. I tend to bounce back and forth between contracts for one or 
the other. Earlier this year I had to convert 3 years worth of Web 
server logs for Kinko's from one format to another. Needless to say, 
their web servers are busy, to the tune of 50 MB per day of logs for 
the one I had to work with. Being the consummate korn shell 
programmer that I am, I hammered out a converter in a couple hours 
and began running the log files through it.

We quickly realized it would take over a week to convert the files 
using a Sun 3500 Server. I knew Perl would do it much faster, but I 
didn't have the knowledge to build a program from scratch. I bugged a 
couple people in the group for ideas, bought Programming Perl and 
Perl Cookbook (already had Learning Perl) on the way home and put 
together a working program that night. I started running a subset of 
the logs and discovered I was processing them about 120x faster in 
perl. I got back in to Kinko's and discovered they didn't have perl 
on the Sun 3500. I ended up processing the entire set of logs before 
noon on a Mac PowerBook 1400/250 running MachTen.

The Shell program is at 
<http://www.ivsoftware.com/shell/logIns2Net.html>. The Perl program 
is at <http://www.ivsoftware.com/perl/logIns2Net.html>.


Mike Schienle                                 Interactive Visuals, Inc.
mgs@ivsoftware.com                  Remote Sensing and Image Processing
http://www.ivsoftware.com/         Analysis and Application Development

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org