i have a tab delimited column file as shown
np np n_nom 3 {RP} {RP}
paNiyappeVttirunna VM_RP V_RP o o o
np np n_nom -3 {/RP} {/RP}
np np n_nom 3 {RP} {RP}
nammal VM_RP V_RP o o o
np np n_nom -3 {/RP}
and there are many such sections seperated by a new line.i want to count the no.of sentences that has {RP} {RP} and {/RP} {/RP} occuring together.If the string is missing from either the 4th or 5th column then it should not be counted.
$countC = 0;
while(<>)
{
chomp;
@array = split(/\t/,$_);
if($array[4] eq $array[5])
{
foreach $item(@array){
if(($item =~ /{RP}/) && ($item++ =~ /{\/RP}/))
{
$countC++;
}
}
}
}
print"CorrectRP=>$countC\n";