Thanks for the help, your commented line works, it's weird that you need double backslash to escape the $ sign. Still, I'm having trouble getting the following code to work:
cmd = "perl -e '\\$i=\"abc def\"; print \\$i;'"
cid = ipcBeginProcess(cmd)
It will complain that "Can't locate object method \"abc\" via package \"def\" (perhaps you forgot to load \"def\"?) at -e line 1.\n". I think the " sign doesn't show up when I run the command this way, thus "abc def" is not recognized as a string.