in reply to Pass object to subroutine.

my $ssh = login($user, $pass, $host); test(\$ssh);

$ssh is already a blessed reference. If you pass it to test() like test(\$ssh), you are passing an unblessed reference to a blessed reference. You should pass it to test like test($ssh).

Update: See also

--MidLifeXis