Hi,
I have 3 arrays.
@arr=("TDP-43 is a highly conserved, 43-kDa RNA-binding protein implicated to play a role in transcription repression, nuclear organization, and alternative splicing","the major disease protein of several neurodegenerative diseases, including frontotemporal lobar degeneration with ubiquitin-positive inclusions","For the splicing activity, the factor has been shown to be mainly an exon-skipping promoter");#main array
@arr1=("TDP-43 is a highly conserved, 43-kDa RNA-binding protein implicated to play a role in transcription repression, nuclear organization, and alternative splicing","the major disease protein of several neurodegenerative diseases, including frontotemporal lobar degeneration with ubiquitin-positive inclusions")
@arr2=("TDP-43 is a highly conserved, 43-kDa RNA-binding protein implicated to play a role in transcription repression, nuclear organization, and alternative splicing","the major disease protein of several neurodegenerative diseases, including frontotemporal lobar degeneration with ubiquitin-positive inclusions");
I want to compare @arr and @arr1 arrays if its matching i should replace with @arr2 contents.Here is the code.
foreach (@arr)
{
foreach $sent(@arr1)
{
if($_=~/$sent/i)
{
print "<br> matched <br>";
foreach $sent2(@arr2)
{
$_=~s/$_/$sent2/ig;
#i am substituting arr2 contents.
}
}
}
print "<br> *** $_ <br>";
}
output i got was like this:
the major disease protein of several neurodegenerative diseases, including frontotemporal lobar degeneration with ubiquitin-positive inclusions
the major disease protein of several neurodegenerative diseases, including frontotemporal lobar degeneration with ubiquitin-positive inclusions
For the splicing activity, the factor has been shown to be mainly an exon-skipping promoter
The problem here is the 2 sentences is being matched but the second matched sentence is getting replaced and not at all printing the first sentence and the last matched sentence is being printed twice (here instead of TDP-43 is a highly conserved, 43-kDa RNA-binding protein implicated to play a role in transcription repression, nuclear organization: the major disease protein of several neurodegenerative diseases, including frontotemporal lobar degeneration with ubiquitin-positive inclusions. is getting printed)
The output should be like this:
TDP-43 is a highly conserved, 43-kDa RNA-binding protein implicated to play a role in transcription repression, nuclear organization
the major disease protein of several neurodegenerative diseases, including frontotemporal lobar degeneration with ubiquitin-positive inclusions
For the splicing activity, the factor has been shown to be mainly an exon-skipping promoter
Any suggestions solving this problem?
How can i substitute the sentence?
With regards
Vanditha