if (ref $res){ #$res is a reference and not a scalar die $res->faultstring; # exit printing the fault } else{ die $soap->transport->status; #Exit with the current transport status of the SOAP object }