haven't used the ssh perl module myself, but i would avoid having to in the first place if possible, by having the script/command on the other side provide output via http, e.g. a CGI wrapper. then you avoid such nasty business as having root password in a script, which i wouldn't allow on any system i work on.
the hardest line to type correctly is: stty erase ^H