in reply to Re: Issue with regex matching
in thread Issue with regex matching

while ($_ =~ m/\Q$constant\E/gc) { $count++; }

Minor point: in  m/\Q$constant\E/gc the  /c modifier is unnecessary, although it does no harm in this instance...

... although wanna_code_perl's
    $count += () = /\Q$constant\E/g;
in a readline loop or
    $count = () = /\Q$constant\E/g;
on a slurped file is, IMHO, better.