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

Re: [MacPerl] Division by zero error from a regex



On Tue, 9 Mar 1999, Chris Blanford wrote:

> I'm trying to process a text file of Current Contents citations with
> MacPerl. I'd appreciate any help here.
> 
> I'm working in "file slurp" mode. I'm trying to remove the extra authors
> to convert lines like these:
> Authors: Occelli ML
> Authors: Biz S
> Authors: Auroux A
> Authors: Ray GJ
> 
> to:
> Authors: Occelli ML; Biz S; Auroux A; Ray GJ
> 
My thoughts are, that there's a time and a place for "file slurp". :-)

In this case, to keep the logic simple, I'd loop over each input line, and
if it has the string "Authors:" at the start, I'd extract the name and
concatenate it to the variable "Authors: Name1; Name2; ...".

You may be getting some dubious gains in speed (although I haven't
checked), but IMHO you're obscuring the logic of a very simple task.

Arved



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