On 20 Apr 2004 at 19:57, [EMAIL PROTECTED] wrote:
> We want to find out the first position $n at which strings $x and $y
> differ. If $x eq $y, then $n is undef. If $x ne $y but $x is a
> prefix (aka initial segment) of $y, then $n should be equal to length
> $x. The operation must preserve both $x and $y (i.e. destructive
> operations are disallowed).
How about [not golfing so the code is clearer]:
my $diff = $x ^ $y;
my ($len) = $diff =~ /^([\0])[^\0]/ ;
return uhdef if not defined $len ;
return length $len;'
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
mailto:[EMAIL PROTECTED] Pearisburg, VA
--> Too many people, too few sheep <--