Digital Media Web Blogs > Web

Perl Success Story: How I Met the Programming Language of My Dreams


Here is a Perl success story that was originally posted by Chris Benson to the Perl advocacy mailing list.

According to Chris,

It's more of a how I met the programming language of my dreams, or as Uri Guttman put it, "how Perl saved my A**", but it was also a success story. This all happened a long, long time ago; when Intel 386s with 12MB of RAM were cutting edge machines so the code isn't used anymore.

HOW PERL SAVED MY A**

Background:

I used to be development/1st-/2nd-/3rd-line tech. support for a software house selling back office systems to lawyers. Lawyers' accounts remain open for the life of a case -- you can't transfer balances at the end of a period like (some) normal accounts. Therefore you have to transfer data from any existing system -- even if it's a 20 year-old mini from a defunct manufacturer, with no support, no documentation, no system software and no file/record layouts.

We would get the user to print all the reports on the system ... and capture the output to disk. I used grep+sed+awk to process these text files into the form our application needed.

The story:

Close of business one Friday afternoon: I visited a firm of lawyers and collected their live data. I took the data home and started the conversion on the machine that I would be installing -- with the converted data -- on Monday morning. (I had already collected test data and written and tested the scripts with a sub-set of the data). The conversion should take until Saturday night, and then I would spend Sunday verifying and crosschecking the results.

Saturday morning: come down to find the machine only 10% through the processing and the disk chattering away. I eventually managed to log in and found that the awk conversion process was using all RAM + 50% swap ... and growing at 4kB every few records...

A quick calculation showed that (a) it would run out of swap before completion and (b) it was not going to be finished in time for a Monday morning installation.

ARRRRRGH!

I was committed to a Monday install. One thing you learn working for lawyers -- you do not upset lawyers: it tends to be expensive.

Aside:

I had been playing round with this new language that has been released (in several dozen messages posted to comp.lang.misc (or something)): Perl -- already at version 3. I had managed to get it compiled on the Altos Unix systems we were using then, but hadn't done much with it -- the challenge had been getting it running on Altos Unix :-), but I'd noticed that (a) it was supposed to be at least 10x faster than awk and (b) it had a awk-to-perl translator. I happened to have a tape with Perl compiled for Altos Unix with me.

Back to the plot:

* I cut several thousand lines of awk code out of the shell scripts they were embedded in and saved them in separate files.

* I installed perl from the tape.

* I ran a2p on the files -- and saved the results. I noticed a few warnings telling me to check whether the correct character or numeric test had been chosen: it had.

* a2p also pointed out a misplaced comment -- that turned out to be causing the memory leak -- but didn't generate an error or warning from awk.

Even though removing the comment had (apparently) solved the problem, I was running late, so having created the Perl scripts I decided to use them: the processing took under 1 hour.

** The processing took under 1 hour. **

The expected processing time in awk was ~18 hours: In spite of the problems with awk, because of Perl I was now ahead of schedule. The system was installed on the Monday morning.

This story still brings tears of relief/joy to my eyes.

I have used Perl ever since.

--

Chris Benson

To learn how large and small companies are using Perl to meet their goals, check out Perl Success Stories.

If you have a Perl success story of your own that you'd like to share, please let me know. You can reach me at: betsy@oreilly.com

Categories





AddThis Social Bookmark Button

Read More Entries by Betsy Waliszewski.

Recommended for You

Topics of Interest

Archives


 
 


Or, visit our complete archive.