in reply to grepping for

Try using m#$dir# instead of /$dir/. Do not hold me to this, but I believe the slashes in the regex are confusing perl.

Perl first does double-quotish expansion ( how does this phrase seem to appear in all my posts? ) before passing anything to the regex engine. In this case, the regex engine is seeing something like /^\//acm\//. Which makes me think it is returning any line beginning with a '/'.

You could also try using the quotemeta modifiers \Q and\E which cause perl to protect all special characters with backslashes. To do this, your regex would look like /\Q$dir\E/. I had mixed luck with the quotemeta stuff a long time ago. It may work better now or your mileage may vary.

Mik
Mik Firestone ( perlus bigotus maximus )