Perl获取用户输入超时
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Perl获取用户输入超时相关的知识,希望对你有一定的参考价值。
Author: jsinix([email protected])This is a script that demonstrates how to get input from keyboard with a timeout. This can be useful in many places.
#!/usr/bin/perl # This is a script that demonstrates # how to get input from keyboard # with a timeout. This can be useful # in many places. use strict; use warnings; sub ask_data { my ($tout) = @_; my $answer; eval { $answer = <STDIN>; }; $answer = 'No answer given'; } } my $data = ask_data('10');
以上是关于Perl获取用户输入超时的主要内容,如果未能解决你的问题,请参考以下文章