""Freddy söderlund"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > ----- Original Message ----- > From: "Rob Anderson" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, September 04, 2003 3:30 PM > Subject: Re: Extracting equal entities from two different sized arrays? > > > > > > >""Freddy söderlund"" <[EMAIL PROTECTED]> wrote in > > > message news:[EMAIL PROTECTED] > > >Hi! > > > > > > > Hi > > Hi again! >
[snip] > > Let me re-phrase my question a bit: > > I want to compare the two strings and I want to extract those chars that are > matching each other in the first and second string (in order from the > beginning), and put them in a new string (not array as I mistakenly said > earlier). > [snip] > > I gave you the wrong flightplan so your rockets didn't take me all the way > to the moon. ;-) > Your example works good but it can't give me the resulting 3:rd string. It > only gives me the number of how many characters that matches. > but you're so close now!. You know how many characters match at the front of the string, so just substring them off. He's a working example, which is spoon feeding a bit, but I guess you don't know the substr function (perldoc -f substr) #!/perl -w use strict; my $string1 = "The quick bruwn fox."; my $string2 = "The quick brown fox."; my $string_xor = ("$string1" ^ "$string2"); $string_xor =~ /^(\0*)/; my $matching_char_count = length($1); my $string3 = substr($string1, 0, $matching_char_count); print $string3 . "<==\n"; HTH Rob Anderson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]