Perl语言中不能执行“usleep”
我正在学习Perl,我有一个问题。我设计了一个简单的程序,但当我运行它时,会出现以下错误:Perl语言中不能执行“usleep”,perl,file,usleep,Perl,File,Usleep,我正在学习Perl,我有一个问题。我设计了一个简单的程序,但当我运行它时,会出现以下错误: Can not exec "usleep": The file or directory does not exist at line 22 example.pl. Can not exec "usleep": The file or directory does not exist at line 65 example.pl. 如何解决呢?谢谢。您可能需要查看模块,而不是执行外部程序。这可以用一种更
Can not exec "usleep": The file or directory does not exist at line 22 example.pl.
Can not exec "usleep": The file or directory does not exist at line 65 example.pl.
如何解决呢?谢谢。您可能需要查看模块,而不是执行外部程序。这可以用一种更直接的方式做你想做的事情
use Time::HiRes 'usleep';
usleep($microseconds);
也许你应该展示你正在询问的代码。是的,这将有助于Time::HiRes的另一个替代方法是使用select函数。例如,要实现250毫秒的睡眠:选择undef,undef,undef,0.25;然而,Time::HiRes是一个核心模块,可能是perferred方法。