Actually it looks like
$$titlename will dereference the scalar instead:
perl -wle 'use strict; my $bar = 3; my $foo = \$bar; print "$$foo"'
# outputs: 3
But OP probably doesn't want to use
$titlename as a scalar ref .. so the line
qq[Title[\@Name="$$titlename"]] => should probably be:
qq[Title[\@Name="$$titlename"]] =>
to OP:
use strict; and
use warnings; would have caught this saying something like
Can't use string ("MyTitleString") as a SCALAR ref while "strict refs" in use at foo.pl line 1234.