You can probably eliminate one or even two levels of escaping here if using a module that wraps rsh (or telnet or ssh).
Net::Rsh],
File::Remote Net::Telnet and
Net::SSH came up in a quick search.
Others have already reflected on how to improve the regex itself.