my $response=`useradd fred ....`; #check the status code (0 = success) if ($? >>8) { # we could not add the user }