Hi,
I have a sentences like this:
I have words like this:
Example 1:
$string="control";
@arr= qw(Our data suggests that shape and growth control are unequally affected,The growth of tissue is control,The observed regulation is due to elevated levels in the blood,The sugar levels are in control and there is change in control of elevated levels in blood);
I want to retrieve the maximum matched sentence and that to be displayed first (For example in 4th sentence control ($string) is occurred twice. I want to display that sentence first and next the lesser occurrence)
Output should be like this:
The sugar levels are in control and there is change in control of elevated levels in blood
The growth of tissue is control
Our data suggests that shape and growth control are unequally affected
The observed regulation is due to elevated levels in the blood
How can i display maximum occurred word in that sentence as first and next the lesser?
To match a sentence i tried like this:
foreach $arr(@arr2)
{
if($arr=~/\b$string\b/i)
{
print "<br>matched<br>";
}
}
Similarly if i have string like this:
Example 2:
$string="shape,control,growth";
How can i get the maximum matched sentence in both cases i.e example 1 and example 2???
Any suggestions??