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

Re: [FWP] Comparing strings the hard way



On Tue, Nov 07, 2000 at 07:58:31AM -0500, Jeff Pinyan wrote:
> 
> This is somewhat related to the greatest substring problem (someone at
> YAPC 19100 gave a talk on it).
> 
>   # greatest_common_substring
>   sub gcs {
>     substr($_[0], 0, length(split /[^\0]/, $_[0]^$_[1], 2)[0]);
>   }

If that compiled, wouldn't it return the first common substring (which is
null if the two strings start with different characters), and not the
greatest common substring?

Ronald

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