eval{ # Set the callback for the alarm signal local $SIG{ALRM} = sub { die ($TIMEOUTERROR) }; # Specify the alarm timeout alarm($TIMEOUT); my @OUTPUT=`$COMMAND 2> &1`; }; alarm(0);