in reply to Remotely Executing a background command

Why not fork off a child process after confirming your ssh connection is successful. Have the child process execute the command you need to check the return value of, and then signal the parent that it (the child) was successful, and that the parent is free to do its thing.

Disclaimer, I've never done this in Perl before, but it works splendidly in C. On POSIX compliant systems, at least. You might want to give perlipc a read if you think this interprocess communication route might be the way for you to go.