in reply to Timeout on STDIN
#!/usr/bin/perl 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); print "@words\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Timeout on STDIN
by boleary (Scribe) on Oct 12, 2016 at 13:39 UTC | |
by soonix (Chancellor) on Oct 14, 2016 at 09:35 UTC | |
by boleary (Scribe) on Oct 24, 2016 at 10:52 UTC | |
by soonix (Chancellor) on Oct 24, 2016 at 11:43 UTC | |
by boleary (Scribe) on Oct 24, 2016 at 14:25 UTC |