in reply to Need Function for Timing out shell commands

I need the return value from the shell programm

You cannot use return from a main program, exit should be used instead (did you use warnings and strict?). Problem with exit though is that you can only return a number (between 0..255), not text. If you must return text:

Replace return $status with print $status
In the shell (Bash or Korn):
/home/fred$ result=$(perl gash.pl) /home/fred$ echo $result Timeout