eval { $ssh->login($user, $pw); }; if ($@) { say "Something went wrong: $@"; }