If you can use ssh instead of rsh (which maybe you should be
doing anyway :), you can use Net::SSH::Perl, which
has a method to execute a command remotely and get back
the stdout, stderr, and exit status.
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new($host);
$ssh->login;
my($out, $err, $exit) = $ssh->cmd($cmd);