in reply to Dealing with errors in subroutines

For what it's worth, I went the eval route, and it works perfectly. I have a script that uses Net::SSH::Expect to connect to a list of servers one at a time, and running various commands and then parsing the output (looking for errors, failures, etc). I was running into issues when the ssh connection would die suddenly (because the server had been turned off) and I got around that by doing this:
my $rc = eval{( $ret =~ />\s*|$\s*\z/) or die "where's the remote prom +pt?";}; if($rc) { if($ret =~ m/[Pp]assword:/) { print("Couldn't connect to host\n"); } }
Originally I tried to check the return code (the $ret) or the return code of the run_ssh() that actually spawns the ssh process, but since the ssh spawned successfully (it just died soon after) it never returned any useful value, and the above command would break if the ssh object was already gone, or if the server was asking for a password (meaning my SSH keys were not set up on that host)

I can give credit to the Monks here for this solution, by the way!
/\ Sierpinski