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

Re: [FWP] COBOL as Perl



It's missing the processing steps. The loop has to decide which
stream to handle _next_. And what to do with it.

Think of comm. Eq gets two tabs, $left gt $right gets one tab,
$left lt $right gets nothing.

Think of a stream of add/delete/modify commands.

<chaim>

>>>>> "BH" == Brand Hilton <bhilton@adc.com> writes:

BH> On Fri, Jul 02, 1999 at 03:06:34PM -0400, Chaim Frenkel wrote:
>> *cringe*.
>> 
>> All typos. In my defense, Your Honor, I can only plead
>> That this is a mental template. Which I typed off-the-cuff.

BH> Welllll, I'll let you off with a warning this time :-)  In that case,
BH> I believe this is functionally equivalent:

BH>   $high_value = "\xff" x 80;      # Or whatever

BH>   do {
BH>     $old_left_key = $left_key;

BH>     $left_key = extract_key($left = <LEFT>) 
BH>       unless $left_key gt $right_key;

BH>     $right_key = extract_key($right = <RIGHT>) 
BH>       unless $old_left_key lt $right_key;

BH>     $key = extract_key();   # Do whatever is needed
BH>   } until $left_key eq $high_value && $right_key eq $high_value;

BH> However, while this version looks more "perlish", it's not as
BH> efficient.  There's the temp copy of $left_key, the loop exit test
BH> each time through the loop, and an extra test when $left_key is less
BH> than $right_key.

BH> But at least it looks cool :-)


-- 
Chaim Frenkel					     Nonlinear Knowledge, Inc.
chaimf@pobox.com				               +1-718-236-0183

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe