in reply to Re: Algorithm::Diff icult to use
in thread Algorithm::Diff icult to use

Hmmm, nevermind.

Actually, I agree with your LoL remark. Returning a flat list seems too low level. Plus, if for any reason a new field needs to be added, so the number is no longer 5, it would break all code using it.

Modified, the code could look like:

my $diff= easy( \@a, \@b ); foreach ( @$diff ) { my( $same, $aMin, $aMax, $bMin, $bMax )= @$_; ... # rest of code snipped because unaltered }

or

my $diff= easy( \@a, \@b ); while (my $row = shift @$diff ) { my( $same, $aMin, $aMax, $bMin, $bMax )= @$row; ... # rest of code snipped because unaltered }

Never mind the extra overhead (if any)... No?

Replies are listed 'Best First'.
Re: Re: Re: Algorithm::Diff icult to use
by RMGir (Prior) on Aug 21, 2002 at 17:33 UTC
    Makes sense. You're right that "5" hardwired everywhere could cause trouble...

    Oh, and I like your foreach better than the shift approach. It's probably faster, and it's what foreach is for. :)
    --
    Mike