## note the \Q before $comm if(($line eq $comm) || ($line =~ /\Q$comm/)){ print"Line $i: $comm"; }