Something like:
use strict; use warnings; use Term::ReadKey; sub timed_input { my $end_time = time + shift; my $string; do { my $key = ReadKey(1); $string .= $key if defined $key; } while (time < $end_time); return $string }; my @words = split ' ', timed_input(10);
should do the job.
In reply to Re: Time-limited input on STDIN
by adrianh
in thread Time-limited input on STDIN
by ajdelore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |