Replacement of sentence in perl

Hi,

I have 3 arrays:

@arr1=("Furthermore, apigenin treatment increased the level of association of the RNA binding protein HuR with endogenous p53 mRNA","one of the mechanisms by which apigenin induces p53 protein expression is enhancement of translation through the RNA binding protein HuR","Here we further demonstrated that the increase in p53 protein level induced by apigenin treatment of 308 keratinoyctes");

@arr2=("Furthermore, apigenin treatment increased the level of association of the RNA binding protein HuR with endogenous p53 mRNA","one of the mechanisms by which apigenin induces p53 protein expression is enhancement of translation through the RNA binding protein HuR");

@arr3=("Moreover, apigenin treatment of cells induced p16 protein expression, which in turn was correlated with cytoplasmic localization of HuR induced by apigenin","nhancement of p53 expression in keratinocytes by the bioflavonoid apigenin");

First i want to compare @arr1 and @arr2 if its matching i want to replace with @arr3 contents.

Here is the code.

foreach $str1(@arr1)
{
   foreach $str2(@arr2)
	{
		if($str1=~/$str2/)
                 {
                      print "<br> matched <br>";
		      foreach $str3(@arr3)
			{
				$str1=~s/$str1/$str3/ig;		
			}
		
		 }

	}
	print "<br> *** $str1 <br>";
} 

Output i got was like this:

Enhancement of p53 expression in keratinocytes by the bioflavonoid apigenin

Moreover, apigenin treatment of cells induced p16 protein expression, which in turn was correlated with cytoplasmic localization of HuR induced by apigenin

Enhancement of p53 expression in keratinocytes by the bioflavonoid apigenin

But the desired output what i should get should be like this:

Moreover, apigenin treatment of cells induced p16 protein expression, which in turn was correlated with cytoplasmic localization of HuR induced by apigenin

Enhancement of p53 expression in keratinocytes by the bioflavonoid apigenin 

Here we further demonstrated that the increase in p53 protein level induced by apigenin treatment of 308 keratinoyctes 

Any ideas like how can i get this?

I am not able to replace the sentence properly!!

How can substitute the matched contents?

I tried to assign the values also but it didn't work!!!

can i hide the sentence??

With regards
Vanitha

You were close. I think this should work.

for (my $i=0; $i <= $#arr1; ++$i) 
{
		if($arr1[ $i ] eq $arr2[ $i ])
                {
                      print "<br> $i matched <br>";
                }
                else { 
                      $arr1[ $i ] = $arr3[ $i ];
                      print "<br> $i replaced <br>";
		}
}
foreach $str1 (@arr1) { 
	print "<br> *** $str1 <br>";
}

If you want to use foreach () then you should also shift @arr2 each time.