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.
In reply to Re^2: Issue with regex matching
by AnomalousMonk
in thread Issue with regex matching
by sowais
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |