in reply to timer in perl

What are $cmd1, $cmd2, $cmd3? If they are blocking processes you'll probably want some sort of sub-process control, perhaps threads, perhaps forks. Maybe you just want alarm?

If they aren't blockers then it isn't clear where the problem lies. As usual, an SSCCE would be best.