http://www.perlmonks.org?node_id=1088604


in reply to Strange behaviour with SSH command launched with open

If you have a look at the help for system it says :-

         If you'd like to manually inspect "system"'s failure, you can
            check all possible failure modes by inspecting $? like this:

                if ($? == -1) {
                    print "failed to execute: $!\n";
                }
                elsif ($? & 127) {
                    printf "child died with signal %d, %s coredump\n",
                        ($? & 127),  ($? & 128) ? 'with' : 'without';
                }
                else {
                    printf "child exited with value %d\n", $? >> 8;
                }

Which will give you 'child exited with value 255', so ssh failed returning -1, therefore check your ssh setup.