my $cmd = 'this is a "testin$g" ok';
print Dumper($cmd);
$VAR1 = 'this is a "testin$g" ok';
my $cmd = 'this is a "testin$g" ok';
$cmd =~ s/\$/\\\$/;
print Dumper($cmd);
$VAR1 = 'this is a "testin\\$g" ok';
I am trying to end up with a string that looks like this: 'this is a "testin\$g" ok'. A single \ in front of the $. But even though I replace the $ with \$ it ends up with two instead.