in reply to Control not coming back to perl script

I'm confused as to what you're trying to accomplish here. You want the output of this command (which means waiting until the output is closed) or to run in the background? You can't do both - at least not with qx. If you want the application to run in the background while you continue, you will, by definition, not get any lines back immediately. You can do this with proper threading or event handling, but you're still not going to get lines immediately. I'm not even sure that you really want the lines, but you're specifically asking for it, so I'm assuming there's a reason why you're using qx instead of system.

Further, I'm confused by those quotes inside the qx. That doesn't make any sense to me whatsoever. If the open double-quote was after the -i, that'd make more sense.

Another option, if you don't need the output, is to use system(1, $cmd) - on Windows, that should start the command in the background, though it'll leave the connection open.

I'd suggest using nohup and redirecting output (the latter which salva suggested). And maybe look into whether plink has some of the ssh options that force its connection into the background.