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

Strawberry Perl无法识别OSNAME的特殊变量

发布时间:2020-12-16 06:19:33 所属栏目:大数据 来源:网络整理
导读:我最近在运行 Windows 7的PC上将Strawberry Perl从版本5.14.1.1-32bit升级到5.24.0-64bit.我有一个perl脚本我在Windows和 Linux下运行,当我使用旧版本命令时 use if $^O eq 'MSWin32','Win32::Console::ANSI'; 工作,但现在我已升级我收到错误消息 Unrecogniz
我最近在运行 Windows 7的PC上将Strawberry Perl从版本5.14.1.1-32bit升级到5.24.0-64bit.我有一个perl脚本我在Windows和 Linux下运行,当我使用旧版本命令时

use if $^O eq 'MSWin32','Win32::Console::ANSI';

工作,但现在我已升级我收到错误消息

Unrecognized character x0F; marked by <-- HERE after use if $<-- HERE near column9 at p:binabc.pl line 31.

有谁知道改变了什么,以及如何让Strawberry Perl的新版本接受命令?提前感谢所有回复的人.

解决方法

您的代码包含 Shift In控制字符(0x0F),也称为“Control-O”,而不是字符^和O.这适用于旧版本的Perl但是 deprecated in version 5.20.0:

Literal control characters in variable names

This deprecation affects things like $cT,where cT is a literal control (such as a NAK or NEGATIVE ACKNOWLEDGE character) in the source code. Surprisingly,it appears that originally this was intended as the canonical way of accessing variables like $^T,with the caret form only being added as an alternative.

The literal control form is being deprecated for two main reasons. It has what are likely unfixable bugs,such as $cI not working as an alias for $^I,and their usage not being portable to non-ASCII platforms: While $^T will work everywhere,cT is whitespace in EBCDIC. [perl #119123]

As of 5.24.0,使用包含非图形ASCII控制字符的变量名称会导致语法错误.

(编辑:李大同)

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

    推荐文章
      热点阅读