in reply to Re^2: doubt in string matching.
in thread doubt in string matching.

Since that you are checking first and last characters with $b[$i-($m-1)] and $b[$i] respectively, your in-between characters should be
@b[$i-($m-2)..$i-1]
That is,
say
$i = 10; $m = 8;
Your first character according to your check should be in $b[3] and last character should be in $b[10]. So the in-between characters should be
@b[4..9]
But you are checking 3..10 again.
From your code, for(my $j=($i-($m-1));$j<=$i;$j++)
I guess this should be
for(my $j=($i-($m-2));$j<=$i-1;$j++) #or for(my $j=($i-($m-2));$j<$i;$j++)
Does this help you.
Thanks..