$userdelex = "sudo /usr/sbin/userdel"; # location of userdel executable sub DeleteUnixAccount{ my ($account,$record) = @_; ### construct the command line, using: # -r = remove the account's home directory for us my @cmd = ($userdelex, "-r", $account); print "@cmd\n"; print "Deleting account..."; my $result = 0xffff & system @cmd; # the return code is 0 for success, non-0 for failure, so we invert if (!$result){ print "succeeded.\n"; return ""; } else { print "failed.\n"; return "$userdelex failed"; } } DeleteUnixAccount(toto);