in reply to system call with time out
perldoc -q timeout
another solution might be trying threads. but i dunno how to kill a thread in perl.