To the specific root-cause solutions offered by others, I would add that enabling warnings along with its good friend strict will let Perl at least give you some hints about problems like this:
c:\@Work\Perl\monks>perl -le
"use warnings;
use strict;
;;
my $directory_name = 'foobar';
my $dir = \"C:\Users\darkblack\Desktop\A\.$directory_name\";
print qq{'$dir'};
"
Unrecognized escape \d passed through at -e line 1.
Unrecognized escape \D passed through at -e line 1.
Unrecognized escape \A passed through at -e line 1.
'C:SERSDARKBLACKDESKTOPA.FOOBAR'
Also, see
Quote and Quote-like Operators in
perlop for double-quotish escapology info.
Give a man a fish: <%-{-{-{-<