see my other post with select
In reply to Re^3: Using SIG{ALRM} within while loop. by bliako in thread Using SIG{ALRM} within while loop. by evroom