in reply to A Quirk in File::Find?

The cause is that the backslash is a special character in regular expressions. This is why you need to use quotemeta on $directory or use \Q...\E when interpolating $directory into your regular expression.

Also, Perl on Windows does not have any problems with using a forward slash instead of a backslash as the directory separator.

$File::Find::dir =~ m|\Q$directory\E\/(.*)|;