http://www.perlmonks.org?node_id=1016870

Mark_Galeck has asked for the wisdom of the Perl Monks concerning the following question:

Hello, (I am not sure if this is a Perl question, or is more a general programming question. If the latter, then I am sorry to post here, please say so and I will begone. )

Every child in kindergarten knows what this does:

while (<>) { process $_ }
What I want, is to get into the loop not only when a new line arrives, but also, after 1 second of waiting for it, (in which case $_ should be empty). I am thinking along the lines of fork or something, but it's going to be somewhat ugly. Is there a nice "monk" way to do this? Thank you, Mark