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

[FWP] Comparing strings the hard way




Perl's string operations are very powerful, but sometimes they're just 
not good enough.  Case in point: I have 2 strings of the same length.
I need to know which portions of them are equal, and which are not.

  @l = map { length } split /[^\c@]/, $a^$b

gives me the lengths of consecutive equal portions of $a and $b.

Useful fun, that.

-- 
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            | ariels@compugen.co.il
Compugen Ltd.          |Tel: +972-2-5713025 (Jerusalem)	\ We recycle all our Hz
72 Pinhas Rosen St.    |Tel: +972-3-7658514 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555    http://3w.compugen.co.il/~ariels

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