in reply to grepping for

Does $dir contain only "acm"? What does your regex look like in the code? What do you think it looks like when $dir is expanded?

I might write code something like this:

my $dir = "/acm"; # open file while (<LOG>) { next unless /^\Q$dir\E/; # do something with $_ because it matches }
If you slurp all of the lines into an array, you could also use the grep command.