use strict; use File::Find; $file = 'test$file.class'; # note that you need to use single quotes here find( sub { /\Q$file\E/ && print "$File::Find::name\n", $destDir });