this is not strictly a perl experience i can say i have had, but are you certain that the forked process which runs in the background can be terminated by your approach.
u might have to start from scratch and check if a running process terminates via your script after the time alloted to it.
then check back with a working script how to enhance it as per your requirement.
Cheers.
also check
Debugging Perl scripts which use fork()