The script below takes function names in a text file and scans on a 
folder that contains multiple c,h files. It opens those files one-by-one and 
reads each line. If the match is found in any part of the files, it prints the 
line number and the line that contains the match. 

Everything is working fine except that the comparison is not working properly. I would be very grateful to whoever solves my problem. 

```
  #program starts:

  use FileHandle;
  print "ENTER THE PATH OF THE FILE THAT CONTAINS THE FUNCTIONS THAT YOU WANT TO     
  SEARCH: ";#getting the input file
  our $input_path = <STDIN>;
  $input_path =~ s/\s+$//;
  open(FILE_R1,'<',"$input_path") ||  die "File open failed!"; 
  print "ENTER THE PATH OF THE FUNCTION MODEL: ";#getting the folder path that 
                                                 #contains multiple .c,.h files
  our $model_path = <STDIN>;
  $model_path =~ s/\s+$//;
  our $last_dir = uc(substr ( $model_path,rindex( $model_path, "\\" ) +1 ));
  our $output = $last_dir."_FUNC_file_names";

  while(our $func_name_input = <FILE_R1> )#$func_name_input is the function name 
                                          #that is taken as the input
  {
     $func_name_input=reverse($func_name_input);
     $func_name_input=substr($func_name_input,rindex($func_name_input,"\("+1);
     $func_name_input=reverse($func_name_input);
     $func_name_input=substr($func_name_input,index($func_name_input," ")+1);

     #above 4 lines are func_name_input is choped and only part of the function 
     #name is taken. 

     opendir FUNC_MODEL,$model_path;
     while (our $file = readdir(FUNC_MODEL))
     {
        next if($file !~ m/\.(c|h)/i);
        find_func($file);       
     }
     close(FUNC_MODEL);
  }

  sub find_func()
  {
     my $fh1 = FileHandle->new("$model_path//$file") or die "ERROR: $!";

     while (!$fh1->eof())
     {
         my $func_name = $fh1->getline(); #getting the line

         **if($func_name =~$func_name_input)**#problem here it does not take the  
                                              #match
         {
             next if($func_name=~m/^\s+/);
             print "$.,$func_name\n";
         }
      }
   }

```