in reply to Interpolation

It does interpolate. I suspect you have path seperators in a pattern to match a variable called $file, and they are becoming an unexpected part of the regex. Fix that by using quotemeta or else the \Q \E metapair in the regex:  if($file=~/\Q$pattern\E/){...}

After Compline,
Zaxo