in reply to Comparing 2 arrays too find the total number of identical elements.

if ($sentencesA[$z] eq $setencesB{$i}){

You seem to be confusing curly braces with square brackets. Plus, "setences" should probably be "sentences". These mistakes would not have happened with strict and warnings.

I cannot test that code because I don't know what is in the variables.

Maybe List::Compare is the best solution to your problem.

Update: Changed List::Util to List::Compare
  • Comment on Re: Comparing 2 arrays too find the total number of identical elements.
  • Download Code