I need to search in a long text, the lines containing text like "candidate no:23."
the line must have a dot in the end. I have tried
$pat = 'candidate no:??'
if ($line =~ /$pat/) {
print "match found \n";
}
This works fine, but not when I try include dot in my pattern
$pat = 'candidate no:??.'
or
$pat = 'candidate no:??\.'
Also tried
if ($line =~ /${pat}\.$/)
None of the above work, can anyone suggest a way out. The pattern must match string "candidate no:(some number)." with a dot and then end of line.