Folks,<br><br> is there a good/simple way of reading from a file descriptor for up to a certain amount of time. For example if I am using a # as my end of input character and have $read_timer set to 5 seconds:<br><FONT FACE=monospace><br> #Select on STDIN <br> ($_nfound,$_timeleft) = select ($_std_in, undef, undef, $read_timer);<br><br> # if we get something...<br> if ($_nfound gt "0"
<br> {<br> #...read the data on STDIN<br> $_cdata = "";<br> read STDIN, $_cdata, 2048;<br> $msg .= $_cdata;<br> }<br></font><br>My problem is that once something is on STDIN (I type something and then press <return>
the Perl proggy will wait for the # character before exiting. <br><br>What I need is for the read to exit either on the # character or after 5 seconds. I've tried several things and am left with the idea of taking the system time upon entering the function, adding read timer to it and the checking the system time every iteration through a while loop (reading a character at a time rather than 2048K).<br><br>Will that work? Does anyone have a better way of doing things?<br><br>Many thanks in advance!<br>Loon