in reply to open(KID, "-|") and wait()?
From the open() perldoc,
Closing any piped filehandle causes the parent process to wait
for the child to finish, and returns the status value in $?.
In other words, perl will handle it for you when you call
close (which may block until the child finishes).