in reply to Time-limited input on STDIN
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Time-limited input on STDIN
by Ackolight (Initiate) on Apr 07, 2009 at 23:21 UTC |
In Section
Seekers of Perl Wisdom