Ariel Scolnicov wrote: > > 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. @l = map { length } split /([^\c@]+)/, $a^$b seems like it gives more useful info for later use w/ substr, so you can compare them, stuff like [david@nicol1 david]$ perl -nle 'chomp; $a = $b; $b = $_; $c=0;%l = map { $c + = $l=length;($c-$l, substr($a,$c-$l,$l))}split/([^\c@]+)/,$a^$b;print %l' -- David Nicol 816.235.1187 nicold@umkc.edu "I must report that I am in the fortunate position of having logged and categorized my nightmares over the past 37 years." -- Bob Dehnhardt ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe