in reply to Running command with backslash not working as expected

So running this command gives the desire result

You don't say what the desired result is. Why not just use qq// until you have solved your problem whatever it might be. eg:

use strict; use warnings; use Test::More tests => 1; my $args = qq#' -c "normal \r"'#; my $cmd = '/usr/local/bin/vim'; my $want = qq#/usr/local/bin/vim . ' -c "normal \r"'#; is ("$cmd . $args", $want); diag ("Tried for >$want<");

Modify as necessary until you can construct the actual string you want. qx// uses the same interpolation as qq// so use the latter when testing.

PS. Why are you using backticks when you are discarding the returned value anyway?