加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

如何在Windows上使用Perl从STDIN中读取单个字符?

发布时间:2020-12-13 20:31:40 所属栏目:Windows 来源:网络整理
导读:使用Perl,如何从STDIN中捕获单个字符而无需用户点击Enter(类似于C的getch()函数)? Perl有一个getc()函数,但根据perlfunc: However,it cannot be used by itself to fetch single characters without waiting for the user to hit enter. perlfunc文档提供
使用Perl,如何从STDIN中捕获单个字符而无需用户点击Enter(类似于C的getch()函数)?

Perl有一个getc()函数,但根据perlfunc:

However,it cannot be used by itself to fetch
single characters without waiting for
the user to hit enter.

perlfunc文档提供了一种使用getc()读取单个字符的方法,但它需要使用stty来操作终端设置.我写的脚本需要在Windows上运行(没有cygwin,msys等) – 所以这不是一个选项.

你想要这个模块: Term::ReadKey.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读