# Loop trying to match current question and next question my $i; for($i = 0; $i < scalar(@questions); $i++) {  my $answer2 = $answer; # !!!NEW!!!  my $j = $i + 1; # $j is the next element of the array  print qq/Checking \$questions[$i] and \$questions[$j] \n/;  print qq/Matching element $i\n/;  if ($answer2 =~ m/$questions[$i]/g) {   print qq(Matched $questions[$i]\n);  } else {   print qq(Did NOT match $questions[$i]\n);   }    if ($questions[$j]) {   if ($answer2 =~ m/\Q$questions[$j]\E/g) {    print qq(Matched $questions[$j]\n);   } else {    print qq(Did NOT match $questions[$j]\n);    }  }    print qq(-----------------------------\n); # Dividing line }