$cmd = "htpasswd -b myusers user3 pass"; print < Executing '$cmd' EOF ; # split the args into a list of strings @args = split(/\s+/, $cmd); # fork a new process off (child process gets 0 from this) if( not ($kid = fork()) ) # are we the kid process? { # if so, do what we want to do exec { $args[0] } @args; # exit cleanly exit(0); } # wait for the child to exit waitpid($kid,0); # print something back print "\n\nAnd now we returned back\n";