$string="hai hello hello.doc yes hai hello.doc present in the file"; $oldstring="hello.doc"; if($string=~ m/\Q$oldstring\E/){ print "\nstring found in ...\n$File::Find::name"; $i++; }