I want to retrive the no of functions(only defined functions and not the calling functions) present in a in a text file(count)

The text file{function.txt}is below

```
#include<main.h>
#include<mncl.h>
int reg23;
int refid23;
int64 AccounntBalance(char *reg12,char *refid,char **id){  //dis is function1
ref();
if(id>100)
  {
  do(&ref);
  }
}                                                        //dis is end of fucntion1
void AccountRetrivalForm(char **regid,char **balance,char **id)   //dis is function2
   {
   doref(); 
   int register;
   if(refid!=null)
    {
   dolog();
     }
   }                                                     //dis is end of function2

```

Now the program as per my logic is:

```
 #!C:/strawberry/perl
 use strict; 
 use warnings; 
 my $filename = 'function_perl.txt';
 my $function_count = 0;
 open(FILENAME,$filename);
 my @arr = join("\n",<FILENAME>);
foreach  my $string(@arr)
  {
 if($string =~/(?:int64|void|boolean)\s?(.*?)\(.*?\)\s*\{/)
     {
 print "HAI";
 $function_count++;
 print '$function_count';
  }
  }

```

Here Function\_count is 1.It never increment for the second match....Please help me with the same code...I am trying so long.I find it hard to fix this.