Some versions of rsh support -t option, which allows you to set timeout. Try it and see whether your version support it.
I am not sure whether alarm is an option for you, as it is not supported on all platforms, even in perl 5.8.0. An alternative way is, before you rsh, use some other command with timeout to determine whether the remote host is reachable, such command include nmap, ping etc.